public function scopeSearch($query, $search)
    {
        return $query->whereName($search)
                     ->orWhere('id', intval($search))
                     ->orWhere('slug', intval($search));
    }
public function scopeSearch($query, $search)
    {
        return $query->whereName($search)
                     ->orWhere('id', intval($search))
                     ->orWhere('slug', intval($search));
    }
public function scopeSearch ( $ query , $ search ) { return $ query -> whereName ( $ search ) -> orWhere ( 'id' , intval ( $ search ) ) -> orWhere ( 'slug' , intval ( $ search ) ) ; }
Query scope for searching permission.

@param $query
@param $search

@return mixed
Query scope for searching permission .