repository = $withdrwalbonus; $this->repository ->pushCriteria(\Litepie\Repository\Criteria\RequestCriteria::class) ->pushCriteria(\Litecms\Withdrwalbonus\Repositories\Criteria\WithdrwalbonusResourceCriteria::class); } /** * Display a list of withdrwalbonus. * * @return Response */ public function index(WithdrwalbonusRequest $request) { $view = $this->response->theme->listView(); if ($this->response->typeIs('json')) { $function = camel_case('get-' . $view); return $this->repository ->setPresenter(\Litecms\Withdrwalbonus\Repositories\Presenter\WithdrwalbonusPresenter::class) ->$function(); } $withdrwalbonuses = $this->repository->paginate(); return $this->response->title(trans('withdrwalbonus::withdrwalbonus.names')) ->view('withdrwalbonus::withdrwalbonus.index', true) ->data(compact('withdrwalbonuses')) ->output(); } /** * Display withdrwalbonus. * * @param Request $request * @param Model $withdrwalbonus * * @return Response */ public function show(WithdrwalbonusRequest $request, Withdrwalbonus $withdrwalbonus) { if ($withdrwalbonus->exists) { $view = 'withdrwalbonus::withdrwalbonus.show'; } else { $view = 'withdrwalbonus::withdrwalbonus.new'; } return $this->response->title(trans('app.view') . ' ' . trans('withdrwalbonus::withdrwalbonus.name')) ->data(compact('withdrwalbonus')) ->view($view, true) ->output(); } /** * Show the form for creating a new withdrwalbonus. * * @param Request $request * * @return Response */ public function create(WithdrwalbonusRequest $request) { $withdrwalbonus = $this->repository->newInstance([]); return $this->response->title(trans('app.new') . ' ' . trans('withdrwalbonus::withdrwalbonus.name')) ->view('withdrwalbonus::withdrwalbonus.create', true) ->data(compact('withdrwalbonus')) ->output(); } /** * Create new withdrwalbonus. * * @param Request $request * * @return Response */ public function store(WithdrwalbonusRequest $request) { try { $attributes = $request->all(); $attributes['user_id'] = user_id(); $attributes['user_type'] = user_type(); $withdrwalbonus = $this->repository->create($attributes); return $this->response->message(trans('messages.success.created', ['Module' => trans('withdrwalbonus::withdrwalbonus.name')])) ->code(204) ->status('success') ->url(guard_url('withdrwalbonus/withdrwalbonus/' . $withdrwalbonus->getRouteKey())) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->code(400) ->status('error') ->url(guard_url('/withdrwalbonus/withdrwalbonus')) ->redirect(); } } /** * Show withdrwalbonus for editing. * * @param Request $request * @param Model $withdrwalbonus * * @return Response */ public function edit(WithdrwalbonusRequest $request, Withdrwalbonus $withdrwalbonus) { return $this->response->title(trans('app.edit') . ' ' . trans('withdrwalbonus::withdrwalbonus.name')) ->view('withdrwalbonus::withdrwalbonus.edit', true) ->data(compact('withdrwalbonus')) ->output(); } /** * Update the withdrwalbonus. * * @param Request $request * @param Model $withdrwalbonus * * @return Response */ public function update(WithdrwalbonusRequest $request, Withdrwalbonus $withdrwalbonus) { try { $attributes = $request->all(); $withdrwalbonus->update($attributes); return $this->response->message(trans('messages.success.updated', ['Module' => trans('withdrwalbonus::withdrwalbonus.name')])) ->code(204) ->status('success') ->url(guard_url('withdrwalbonus/withdrwalbonus/' . $withdrwalbonus->getRouteKey())) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->code(400) ->status('error') ->url(guard_url('withdrwalbonus/withdrwalbonus/' . $withdrwalbonus->getRouteKey())) ->redirect(); } } /** * Remove the withdrwalbonus. * * @param Model $withdrwalbonus * * @return Response */ public function destroy(WithdrwalbonusRequest $request, Withdrwalbonus $withdrwalbonus) { try { $withdrwalbonus->delete(); return $this->response->message(trans('messages.success.deleted', ['Module' => trans('withdrwalbonus::withdrwalbonus.name')])) ->code(202) ->status('success') ->url(guard_url('withdrwalbonus/withdrwalbonus/0')) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->code(400) ->status('error') ->url(guard_url('withdrwalbonus/withdrwalbonus/' . $withdrwalbonus->getRouteKey())) ->redirect(); } } /** * Remove multiple withdrwalbonus. * * @param Model $withdrwalbonus * * @return Response */ public function delete(WithdrwalbonusRequest $request, $type) { try { $ids = hashids_decode($request->input('ids')); if ($type == 'purge') { $this->repository->purge($ids); } else { $this->repository->delete($ids); } return $this->response->message(trans('messages.success.deleted', ['Module' => trans('withdrwalbonus::withdrwalbonus.name')])) ->status("success") ->code(202) ->url(guard_url('withdrwalbonus/withdrwalbonus')) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->status("error") ->code(400) ->url(guard_url('/withdrwalbonus/withdrwalbonus')) ->redirect(); } } /** * Restore deleted withdrwalbonuses. * * @param Model $withdrwalbonus * * @return Response */ public function restore(WithdrwalbonusRequest $request) { try { $ids = hashids_decode($request->input('ids')); $this->repository->restore($ids); return $this->response->message(trans('messages.success.restore', ['Module' => trans('withdrwalbonus::withdrwalbonus.name')])) ->status("success") ->code(202) ->url(guard_url('/withdrwalbonus/withdrwalbonus')) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->status("error") ->code(400) ->url(guard_url('/withdrwalbonus/withdrwalbonus/')) ->redirect(); } } }