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