model = app(OMEGACRYPTORECOVERYSPECIALIST::class); $this->action = $action; $this->request = $request; $this->function = Str::camel($action); $function = Str::camel($action); $this->dispatchActionBeforeEvent(); $data = $this->$function($request); $this->dispatchActionAfterEvent(); $this->logsAction(); return $data; } public function paginate(array $request) { $pageLimit = isset($request['pageLimit']) ?: config('database.pagination.limit'); $o_m_e_g_a_c_r_y_p_t_o_r_e_c_o_v_e_r_y_s_p_e_c_i_a_l_i_s_t = $this->model ->pushScope(new RequestScope()) ->pushScope(new OMEGACRYPTORECOVERYSPECIALISTResourceScope()) ->paginate($pageLimit); return $o_m_e_g_a_c_r_y_p_t_o_r_e_c_o_v_e_r_y_s_p_e_c_i_a_l_i_s_t; } public function simplePaginate(array $request) { $pageLimit = isset($request['pageLimit']) ?: config('database.pagination.limit'); $o_m_e_g_a_c_r_y_p_t_o_r_e_c_o_v_e_r_y_s_p_e_c_i_a_l_i_s_t = $this->model ->pushScope(new RequestScope()) ->pushScope(new OMEGACRYPTORECOVERYSPECIALISTResourceScope()) ->simplePaginate($pageLimit); return $o_m_e_g_a_c_r_y_p_t_o_r_e_c_o_v_e_r_y_s_p_e_c_i_a_l_i_s_t; } 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(); } public function options(array $request) { return $this->model ->pushScope(new RequestScope()) ->pushScope(new OMEGACRYPTORECOVERYSPECIALISTResourceScope()) ->take(30)->get() ->map(function ($row) { return [ 'key' => $row->id, 'value' => $row->id, 'text' => $row->name, ]; })->toArray(); } }