middleware(function ($request, $next) { $this->form = PayrecReceiptsForm::grouped(false) ->setAttributes() ->toArray(); $this->modules = $this->modules(config('bixo.account.modules'), 'account', guard_url('account')); return $next($request); }); } /** * Display a list of payrec_receipts. * * @return Response */ public function index(PayrecReceiptsResourceRequest $request) { $request = $request->all(); $page = PayrecReceiptsActions::run('paginate', $request); $data = new PayrecReceiptsCollection($page); $form = $this->form; $modules = $this->modules; return $this->response->setMetaTitle(trans('account::payrec_receipts.names')) ->view('account::payrec_receipts.index') ->data(compact('data', 'modules', 'form')) ->output(); } /** * Display payrec_receipts. * * @param Request $request * @param Model $payrec_receipts * * @return Response */ public function show(PayrecReceiptsResourceRequest $request, PayrecReceipts $model) { $form = $this->form; $modules = $this->modules; $data = new PayrecReceiptsResource($model); return $this->response ->setMetaTitle(trans('app.view') . ' ' . trans('account::payrec_receipts.name')) ->data(compact('data', 'form', 'modules')) ->view('account::payrec_receipts.show') ->output(); } /** * Show the form for creating a new payrec_receipts. * * @param Request $request * * @return Response */ public function create(PayrecReceiptsResourceRequest $request, PayrecReceipts $model) { $form = $this->form; $modules = $this->modules; $data = new PayrecReceiptsResource($model); return $this->response->setMetaTitle(trans('app.new') . ' ' . trans('account::payrec_receipts.name')) ->view('account::payrec_receipts.create') ->data(compact('data', 'form', 'modules')) ->output(); } /** * Create new payrec_receipts. * * @param Request $request * * @return Response */ public function store(PayrecReceiptsResourceRequest $request, PayrecReceipts $model) { try { $request = $request->all(); $model = PayrecReceiptsAction::run('store', $model, $request); $data = new PayrecReceiptsResource($model); return $this->response->message(trans('messages.success.created', ['Module' => trans('account::payrec_receipts.name')])) ->code(204) ->data(compact('data')) ->status('success') ->url(guard_url('account/payrec_receipts/' . $model->getRouteKey())) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->code(400) ->status('error') ->url(guard_url('/account/payrec_receipts')) ->redirect(); } } /** * Show payrec_receipts for editing. * * @param Request $request * @param Model $payrec_receipts * * @return Response */ public function edit(PayrecReceiptsResourceRequest $request, PayrecReceipts $model) { $form = $this->form; $modules = $this->modules; $data = new PayrecReceiptsResource($model); // return view('account::payrec_receipts.edit', compact('data', 'form', 'modules')); return $this->response->setMetaTitle(trans('app.edit') . ' ' . trans('account::payrec_receipts.name')) ->view('account::payrec_receipts.edit') ->data(compact('data', 'form', 'modules')) ->output(); } /** * Update the payrec_receipts. * * @param Request $request * @param Model $payrec_receipts * * @return Response */ public function update(PayrecReceiptsResourceRequest $request, PayrecReceipts $model) { try { $request = $request->all(); $model = PayrecReceiptsAction::run('update', $model, $request); $data = new PayrecReceiptsResource($model); return $this->response->message(trans('messages.success.updated', ['Module' => trans('account::payrec_receipts.name')])) ->code(204) ->status('success') ->data(compact('data')) ->url(guard_url('account/payrec_receipts/' . $model->getRouteKey())) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->code(400) ->status('error') ->url(guard_url('account/payrec_receipts/' . $model->getRouteKey())) ->redirect(); } } /** * Remove the payrec_receipts. * * @param Model $payrec_receipts * * @return Response */ public function destroy(PayrecReceiptsResourceRequest $request, PayrecReceipts $model) { try { $request = $request->all(); $model = PayrecReceiptsAction::run('destroy', $model, $request); $data = new PayrecReceiptsResource($model); return $this->response->message(trans('messages.success.deleted', ['Module' => trans('account::payrec_receipts.name')])) ->code(202) ->status('success') ->data(compact('data')) ->url(guard_url('account/payrec_receipts/0')) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->code(400) ->status('error') ->url(guard_url('account/payrec_receipts/' . $model->getRouteKey())) ->redirect(); } } }