Skip to content

Company Service

The Company Service exposes methods to create, update, delete, get, list companies, also some other operations related to companies.

Usage

php
use \Lordjoo\Apigee\Facades\Apigee;
$companyService = Apigee::edge()->company();
use \Lordjoo\Apigee\Facades\Apigee;
$companyService = Apigee::edge()->company();

List all companies

Using the get() method, you can get a collection of all companies.

php
$companies = $companyService->get();
$companies = $companyService->get();

$companies is a Laravel Collection of Company objects.

Get a company by name

Using the find() method, you can get a company by name.

php
$company = $companyService->find($companyName);
$company = $companyService->find($companyName);

$company is an instance of Company object.

Create a company

Using the create() method, you can create a company, the create() method accepts one parameter $data where $data is an array of the company properties CompanyRequest

php
$company = $companyService->create($data);
$company = $companyService->create($data);

Update a company

Using the update() method, you can update a company, the update() method accepts two parameters $companyName and $data where $companyName is the name of the company you want to update and $data is an array of the company properties CompanyRequest

php
$company = $companyService->update($companyName, $data);
$company = $companyService->update($companyName, $data);

Note

The create and update method will do a validation check on the data you passed, so if you passed an invalid data, the method will throw a validation exception.

Delete a company

Using the delete() method, you can delete a company by it's name.

php
$companyService->delete($companyName);
$companyService->delete($companyName);

Update a company's status

Using the updateStatus() method, you can change a company's status by it's name. the updateStatus() method accepts two parameters $companyName and $status where $companyName is the name of the company you want to change the status of and $status is the new status of the company, it can be active or inactive

php
$companyService->updateStatus($companyName, $status);
$companyService->updateStatus($companyName, $status);

Entity

Properties

NameTypeDescription
namestringThe name of the company
displayNamestringThe display name of the company
statusstringThe status of the company, it can be active or inactive
attributesAttribute[]Attributes of the API Product
organizationstringThe organization that the company belongs to
createdAtstringThe date and time the company was created in ISO 8601 format
lastModifiedAtstringThe date and time the company was last modified in ISO 8601 format
lastModifiedBystringThe user who last modified the company

Methods

getApps()

Get a collection of all apps of the company.

php
$apps = $company->getApps();
$apps = $company->getApps();

$apps is a Laravel Collection of CompanyApp objects.

activate()

Activate the company.

php
$company->activate();
$company->activate();

deactivate()

Deactivate the company.

php
$company->deactivate();
$company->deactivate();

update($data)

Update the company, the update() method accepts one parameter $data where $data is an array of the company properties CompanyRequest

php
$company->update($data);
$company->update($data);

delete()

Delete the company.

php
$company->delete();
$company->delete();

Released under the MIT License.