request = $request; } /** * @param $model * @param RepositoryInterface $repository * * @return mixed */ public function apply($model, RepositoryInterface $repository) { if ($this->request->filled('name')) { $model = $model->where('name', 'like', '%' . $this->request->get('name') . '%'); } if ($this->request->filled('type')) { $model = $model->where('type', 'like', '%' . $this->request->get('type') . '%'); } if ($this->request->filled('type_id')) { $model = $model->where('type_id', '=', $this->request->get('type_id')); } if ($this->request->filled('admin_id')) { $model = $model->where('admin_id', '=', $this->request->get('admin_id')); } if ($this->request->filled('make_status')) { $model = $model->where('make_status', '=', $this->request->get('make_status')); } $model = $model->orderByDesc('id'); return $model; } }