/** * Update the specified resource in storage. * * @param int $id * * @return void */ public function update($id, Request $request) { $this->validate($request, ['id' => 'required|string', 'key' => 'required|string', 'summary' => 'required|string', 'description' => 'string']); $issue = Issue::findOrFail($id); $issue->update($request->all()); Session::flash('flash_message', 'Issue updated!'); Session::flash('flash_message_type', 'success'); return redirect('issues'); }
/** * Store a newly created resource in storage. * * @return void */ public function store(Request $request) { $this->validate($request, ['id' => 'required|integer', 'issue_id' => 'required|exists:issues,id', 'author' => 'required|string', 'comment' => 'string', 'started' => 'required|date', 'timeSpent' => 'required|string', 'timeSpentSeconds' => 'required|string']); $issue = Issue::findOrFail($request->issue_id); $worklog = new Worklog($request->all()); $issue->addWorklog($worklog); Session::flash('flash_message', 'Worklog added!'); Session::flash('flash_message_type', 'success'); return redirect('worklogs'); }