Skip to content

Member Request

Ben Sherred edited this page Dec 19, 2019 · 6 revisions

Introduction

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.

Getting a Member

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`

Available Methods

The CompanyMember model has a couple of methods to get additional information about the company member.

Method Listing

getId()

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();