/**
  * Update the specified todo in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $todo = Todo::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Todo::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $todo->update($data);
     return Redirect::route('todos.index');
 }
Esempio n. 2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $todo = $this->todo->findOrFail($id);
     return View::make('todos.show', compact('todo'));
 }