model = $activity_project; $this->model->setUserFilter(); parent::__construct(); } /** * Display a listing of the resource. * * @return Response */ public function index(ActivityProjectUserRequest $request) { $activity_projects = $this->model->all(); $this->theme->prependTitle(trans('activity_project::activity_project.names').' :: '); return $this->theme->of('activity_project::user.activity_project.index', compact('activity_projects'))->render(); } /** * Display the specified resource. * * @param Request $request * @param int $id * * @return Response */ public function show(ActivityProjectUserRequest $request, $role, $id) { $activity_project = $this->model->find($id); return $this->theme->of('activity_project::user.activity_project.show', compact('activity_project'))->render(); } /** * Show the form for creating a new resource. * * @param Request $request * * @return Response */ public function create(ActivityProjectUserRequest $request) { $activity_project = $this->model->findOrNew(0); Former::populate($activity_project); return $this->theme->of('activity_project::user.activity_project.create', compact('activity_project'))->render(); } /** * Display the specified resource. * * @param Request $request * * @return Response */ public function store(ActivityProjectUserRequest $request) { try { $attributes = $request->all(); $activity_project = $this->model->create($attributes); return $this->success(trans('messages.success.created', ['Module' => trans('activity_project::activity_project.name')])); } catch (Exception $e) { return $this->error($e->getMessage()); } } /** * Show the form for editing the specified resource. * * @param Request $request * @param int $id * * @return Response */ public function edit(ActivityProjectUserRequest $request, $role, $id) { $activity_project = $this->model->find($id); Former::populate($activity_project); return $this->theme->of('activity_project::user.activity_project.edit', compact('activity_project'))->render(); } /** * Update the specified resource. * * @param Request $request * @param int $id * * @return Response */ public function update(ActivityProjectUserRequest $request, $role, $id) { try { $attributes = $request->all(); $activity_project = $this->model->update($attributes, $id); return $this->success(trans('messages.success.updated', ['Module' => trans('activity_project::activity_project.name')])); } catch (Exception $e) { return $this->error($e->getMessage()); } } /** * Remove the specified resource. * * @param int $id * * @return Response */ public function destroy(ActivityProjectUserRequest $request, $role, $id) { try { $this->model->delete($id); return $this->success(trans('message.success.deleted', ['Module' => trans('activity_project::activity_project.name')]), 200); } catch (Exception $e) { return $this->error($e->getMessage()); } } }