request = \request(); } else { $this->request = $request; } } /** * Apply criteria in query repository * * @param string $model * @param RepositoryInterface $repository * * @return mixed */ public function apply($model, RepositoryInterface $repository) { if ($turename = $this->request->get('turename')) { $model = $model->where('turename', 'like', "%{$turename}%"); } if ($account = $this->request->get('account')) { $model = $model->where('account', 'like', "%{$account}%"); } if ($period = $this->request->get('period')) { $model = $model->where('period', 'like', $period); } $model = $model->orderByDesc('id'); return $model; } }