-
Notifications
You must be signed in to change notification settings - Fork 15
Member Request
Each company member relates to a player and you can the information for a member by executing the following request. If you want to get all the members for a company, check out the Members Request page.
To get the information about a member, you can call the member(int $id)
method on an instance of CompanyRequest
. This will return an instance of CompanyMember
.
<?php
require_once('vendor/autoload.php');
$client = new TruckersMP\APIClient();
$member = $client->company(1)->member(1)->get(); // This is an instance of `CompanyMember`
The CompanyMember
model has a couple of methods to get additional information about the company member.
The getId
method returns the ID of the company member
$member = $client->company(1)->member(1)->get();
echo 'The ID of the requested member is ' . $member->getId();
getUserId()
The getUserId
method returns the ID of the members account.
$member = $client->company(1)->member(1)->get();
echo 'The members account ID is ' . $member->getUserId();
getUsername()
The getUsername
method returns the members name.
$member = $client->company(1)->member(1)->get();
echo 'The name of this member is ' . $member->getUsername();
getSteamId()
The getSteamId
method returns the Steam ID of the member.
$member = $client->company(1)->member(1)->get();
echo 'The members Steam ID is ' . $member->getSteamId();
getRoleId()
The getRoleId
method returns the ID of the company member.
$member = $client->company(1)->member(1)->get();
$roleId = $member->getRoleId();
echo 'The ID of the members role is {$roleID}';
getRole()
The getRole
method returns the name of the members role.
$member = $client->company(1)->member(1)->get();
$role = $member->getRole();
echo 'This member has the {$role} role';
getJoinDate()
The getJoinDate
method returns the date the member joined the company as an instance of Carbon
. For more information on dates, please refer to the timestamps page.
$member = $client->company(1)->member(1)->get();
echo 'This member joined the company ' . $member-> 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.