model = app(Category::class); $function = Str::camel($action); event('crm.category.category.action.' . $action . 'ing', [$request]); $data = $this->$function($request); event('crm.category.category.action.' . $action . 'ed', [$data]); $this->logsAction(); return $data; } public function paginate(array $request) { $pageLimit = isset($request['pageLimit']) ?: config('database.pagination.limit'); $category = $this->model ->pushScope(new RequestScope()) ->pushScope(new CategoryResourceScope()) ->paginate($pageLimit); return $category; } public function simplePaginate(array $request) { $pageLimit = isset($request['pageLimit']) ?: config('database.pagination.limit'); $category = $this->model ->pushScope(new RequestScope()) ->pushScope(new CategoryResourceScope()) ->simplePaginate($pageLimit); return $category; } function empty(array $request) { return $this->model->forceDelete(); } function restore(array $request) { return $this->model->restore(); } public function delete(array $request) { $ids = $request['ids']; $ids = collect($ids)->map(function ($id) { return hashids_decode($id); }); return $this->model->whereIn('id', $ids)->delete(); } }