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