-
Notifications
You must be signed in to change notification settings - Fork 15
Roles Request
Ben Sherred edited this page Nov 5, 2021
·
5 revisions
Companies can group their members together using roles. These roles can also be assigned permissions to extend a members abilities. To get a companies roles you can execute the following code.
To get the roles for a company, you can call the roles()
method on the CompanyRequest
. This will return an instance of RoleCollection
.
<?php
require_once('vendor/autoload.php');
$client = new TruckersMP\APIClient();
$roles = $client->company(1)->roles()->get(); // This is instance of `RoleCollection`
You can then loop through the roles to get information about a specific role. For more information, check out the available methods on the Role Request page.
$roles = $client->company(1)->roles()->get();
$count = 0;
foreach ($roles as $role) {
$count++;
}
echo "This company has {$count} roles";
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.