where('phone', $phone); } /** * Summary of scopeNotAgent * @param mixed $query * @param mixed $agentId * @return mixed */ public function scopeNotAgent($query, $agentId) { return $query->where('agent_id', '<>', $agentId); } /** * Summary of scopeInAgent * @param mixed $query * @param mixed $agentId * @return mixed * **/ public function scopeInAgent($query, $agentId) { return $query->where('agent_id', '=', $agentId); } public function scopeSearch($query, $searchKey) { return $query->where(function ($query) use ($searchKey) { $query->where('name', 'LIKE', '%' . $searchKey . '%') ->orWhere('phone', 'LIKE', '%' . $searchKey . '%') ->orWhere('email', 'LIKE', '%' . $searchKey . '%'); }); } }