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