I'm new to Laravel, I want to understand what is the best approach to share values from controllers to views: I have found few ways of doing it :
- view()->share('variable_name',$value);
- session(['variable_name'=>$value]);
- return view('viewname')->with('variable_name'=>$value);
Is there any difference between these ways? Also, is it a good practice to share data from the model(from design point of view)?
Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire