📅  最后修改于: 2022-03-11 14:54:01.935000             🧑  作者: Mango
// in your model
public function scopeField($query)
{
return $query->where('field', 'value'); // if in header return $query->where('field', request()->field);
}
// in your controller or repository
public function index()
{
return Package::field()->get();
}