['required', $unique, 'phone'] ]; $updateRules = [ 'phone' => ['phone', $unique->ignore($primaryKey)] ]; $validator = Validator::make($data, $primaryKey ? $updateRules : $createRules); if ($validator->fails()) { throw new AdminValidationException($validator->errors()); } } public function sortable($query) { $query->orderByDesc('id'); } public function searchable($query) { $query->filter(request()->all()); } public function deleted($ids) { $ids = explode(',', $ids); $this->query()->where(function ($q) use ($ids) { foreach ($ids as $id) { $q->orWhere('path', 'like', '%-'.$id.'-%'); } })->delete(); } }