/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(ProjectRequest $request, $id) { $project = Project::find($id); if ($project) { $input = $request->except($this->image); $input['start_date'] = Carbon\Carbon::parse($request->get('start_date'))->format('Y-m-d'); $input['end_date'] = Carbon\Carbon::parse($request->get('end_date'))->format('Y-m-d'); $input[$this->image] = Project::upload_projectfile($request, $this->image, $project->image); $input['updated_by'] = Auth::user()->id; $project->fill($input); $project->save(); Session::flash($this->success, Lang::get('ruban.project.updated')); $timeline['object_type'] = 1; $timeline['object_id'] = $id; $timeline['action'] = 'update'; $timeline['description'] = '<a href="javascript:;">' . $input['name'] . '</a> project has been updated by ' . Auth::user()->first_name . ' ' . Auth::user()->last_name . '.'; Timeline::create($timeline); return Redirect::route('ruban.projects.index'); } else { Session::flash($this->danger, Lang::get('ruban.project.notfound')); return Redirect::route('ruban.projects.index'); } }