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