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