1// in your model
2public function scopeField($query)
3 {
4 return $query->where('field', 'value'); // if in header return $query->where('field', request()->field);
5 }
6
7// in your controller or repository
8 public function index()
9 {
10 return Package::field()->get();
11 }
1public function apply(Builder $builder, Model $model)
2 {
3 $builder->where('age', '>', 200);
4 }