public function store(StoreTodoPostRequest $request)
 {
     $todo = Todo::findOrNew($request->id)->fill($request->all());
     if (!empty($todo->text)) {
         $todo->save();
     }
     return redirect()->back();
 }
Exemple #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postStore()
 {
     $todo = Todo::findOrNew(1);
     $comment = new Comment();
     $comment->body = 'xxxxxxxxxxxx';
     $todo->comments()->save($comment);
     return;
 }