order = $order; $this->limit = $limit; } public function apply($model, RepositoryInterface $repository) { if (!empty($this->order)) { foreach ($this->order as $item) { $model = $model->orderBy($item[0], $item[1]); } } if (!empty($this->limit)) { $model = $model->take($this->limit); } return $model; } }