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