-
Notifications
You must be signed in to change notification settings - Fork 15
Role Request
Each company member is assigned a role when they join a company. This role is then assigned permissions to give the player access to additional features within the company. To get the information about a role, you can execute the following commands.
To get the information about a role, you can call the role(int $id)
method on an instance of CompanyRequest
. This will return an instance of CompanyRole
.
<?php
require_once('vendor/autoload.php');
$client = new TruckersMP\APIClient();
$role = $client->company(1)->role(1)->get(); // This is an instance of `CompanyRole`
The CompanyRole
model has a couple of methods to get additional information about the company role.
The getId
method returns the ID of the role.
$role = $client->company(1)->role(1)->get();
echo 'The ID of the requested role is ' . $role->getId();
The getName
method returns the name of the role.
$role = $client->company(1)->role(1)->get();
echo 'The name of the role is ' . $role->getName();
The getOrder
method returns the the order in which the role is displayed (0 being the highest).
$role = $client->company(1)->role(1)->get();
echo 'This roles order ID is ' . $member->getOrder();
The isOwner
method returns if the role is the owner of the company.
$role = $client->company(1)->role(1)->get();
if ($role->isOwner()) {
echo 'This role is the owner role';
} else {
echo 'This role is not the owner role';
}
The getCreatedAt
method returns the date the role was created as an instance of Carbon. For more information on dates, please refer to the timestamps page.
$role = $client->company(1)->role(1)->get();
echo 'This role was created ' . $role->diffForHumans();
The getUpdatedAt
method returns the date the role was last updated as an instance of Carbon. For more information on dates, please refer to the timestamps page.
$role = $client->company(1)->role(1)->get();
echo 'This role was updated ' . $role->diffForHumans();
If you have any questions about the library, you can create a topic on our forum.
This package is open-source and is licensed under the MIT license.