/** * Update the specified log in storage. * * @param int $id * @return Response */ public function update($id) { $log = Logbook::findOrFail($id); $validator = Validator::make($data = Input::all(), Logbook::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $log->update($data); return Redirect::route('admin.logs.index')->with("successMessage", "Berhasil menyimpan kegiatan"); }
/** * Remove the specified resource from storage. * * @param int $logbook_id * @return Response */ public function destroy($logbook_id) { $logbook = Logbook::findOrFail($logbook_id); $logbook->delete(); return Redirect::to(route('logbooks.index'))->with('message', ['content' => 'Logboek met succes verwijderd!', 'class' => 'success']); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($logbook_id, $entry_id) { $logbook = Logbook::findOrFail($logbook_id); if ($logbook->user_id == Auth::user()->id || $logbook->user_id == 0) { $entry = Entry::findOrFail($entry_id); $entry->fill(Input::only('title', 'body', 'started_at', 'finished_at', 'evidence_id', 'who', 'what', 'where', 'which', 'way', 'when', 'why')); if ($entry->validate()) { $entry->save(); } else { return View::make('entries.edit', ['entry' => $entry, 'logbook' => $logbook])->withErrors($entry->validator()); } return Redirect::to(route('logbooks.show', [$logbook->id]))->with('message', ['content' => 'Entry met succes geupdated!', 'class' => 'success']); } else { return Redirect::to(route('logbooks.show', [$logbook->id]))->with('message', ['content' => 'Geen rechten om entry te updaten!', 'class' => 'danger']); } }