model = app(MasterService::class); $function = Str::camel($action); event('b2buy.master_service.master_service.action.' . $action . 'ing', [$request]); $data = $this->$function($request); event('b2buy.master_service.master_service.action.' . $action . 'ed', [$data]); $this->logsAction(); return $data; } public function paginate(array $request) { $pageLimit = isset($request['pageLimit']) ?: config('database.pagination.limit'); $master_service = $this->model ->pushScope(new RequestScope()) ->pushScope(new MasterServiceResourceScope()) ->paginate($pageLimit); return $master_service; } public function simplePaginate(array $request) { $pageLimit = isset($request['pageLimit']) ?: config('database.pagination.limit'); $master_service = $this->model ->pushScope(new RequestScope()) ->pushScope(new MasterServiceResourceScope()) ->simplePaginate($pageLimit); return $master_service; } 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(); } }