protected $filters = ['all_except'];
public function all_except($query, $value) {
return $query->where('name', '!=', $value);
}
protected $filters = ['in'];
public function in($query, $value) {
$exploded = explode(',', $value);
if(count($exploded) != 4) {
// throwing an exception or whatever you like to do
}
$field = array_shift($exploded);
return $query->whereIn($field, $exploded);
}
protected $filters = ['by'];
public function by($query, $value) {
return $query->where('username', $value);
}
User::filter('in')->get();
User::filter('like', 'name')->get();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.