for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* AgentParticipants
*
* @package LivePersonInc\LiveEngageLaravel\Collections
*/
namespace LivePersonInc\LiveEngageLaravel\Collections;
use Illuminate\Support\Collection;
use LivePersonInc\LiveEngageLaravel\Models\Agent;
use LivePersonInc\LiveEngageLaravel\Models\MetaData;
* AgentParticipants class.
* @extends Collection
class AgentParticipants extends Collection
{
* metaData
* @var \LivePersonInc\LiveEngageLaravel\Models\MetaData
* @access public
public $metaData;
* __construct function.
* @param array $models (default: [])
* @return void
public function __construct(array $models = [])
$models = array_map(function($item) {
return is_a($item, 'LivePersonInc\LiveEngageLaravel\Models\Agent') ? $item : new Agent((array) $item);
}, $models);
$this->metaData = new MetaData();
parent::__construct($models);
}
* state function returns any agents in the collection with the specified availability state.
* @param string $state (default: 'ONLINE')
* @return \LivePersonInc\LiveEngageLaravel\Models\Agent
public function state($state = 'ONLINE')
$result = $this->filter(function($value) use ($state) {
return strtolower($value->currentStatus) == strtolower($state);
});
return $result;
return $result
LivePersonInc\LiveEngage...tions\AgentParticipants
LivePersonInc\LiveEngageLaravel\Models\Agent
* findById function.
* @param int $agentId
public function findById($agentId)
$result = $this->filter(function($value) use ($agentId) {
return $value->agentId == $agentId;
return $result->first();