src/Models/Agent.php
public function scopeAgentsLists($query)
    {
        if (version_compare(app()->version(), '5.2.0', '>=')) {
            return $query->where('ticketit_agent', '1')->pluck('name', 'id')->toArray();
        } else { // if Laravel 5.1
            return $query->where('ticketit_agent', '1')->lists('name', 'id')->toArray();
        }
    }
public function scopeAgentsLists($query)
    {
        if (version_compare(app()->version(), '5.2.0', '>=')) {
            return $query->where('ticketit_agent', '1')->pluck('name', 'id')->toArray();
        } else { // if Laravel 5.1
            return $query->where('ticketit_agent', '1')->lists('name', 'id')->toArray();
        }
    }
public function scopeAgentsLists ( $ query ) { if ( version_compare ( app ( ) -> version ( ) , '5.2.0' , '>=' ) ) { return $ query -> where ( 'ticketit_agent' , '1' ) -> pluck ( 'name' , 'id' ) -> toArray ( ) ; } else { // if Laravel 5.1 return $ query -> where ( 'ticketit_agent' , '1' ) -> lists ( 'name' , 'id' ) -> toArray ( ) ; } }
list of all agents and returning lists array of id and name.

@param $query

@return bool

@internal param int $cat_id
list of all agents and returning lists array of id and name .