lundi 5 octobre 2020

What is the difference between with, compact and array in when return view in laravel

I'm little bit confuse I want to know the difference between those three returns:

return view('post', ['post' => $post]);

return view('post', compact('post'));

return view('post')->with('post'=>$post);

So, can someone explain for me the difference in easy way.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire