jeudi 8 août 2019

Unexpected data found. Unexpected data found. Data missing

Unexpected data found. Unexpected data found. Data missing

what is the wrong with my code ??

public function update(Request $request , $id ) {

  $request->validate([
    'title' => 'required|max:200',
    'body' =>  'required|max:500'
  ]);

  // $post = new Post();
  $post = new Post();
  $post = Post::find($id);
  $post->title = $request->title;
  $post->body = $request->body;
  $post->user_id = auth()->User()->id;
  $post->save();
  return redirect('/posts')->with('status', 'Post was Updated !');
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire