I have a doubt. I have been checking laracasts and they show some examples of passing variable(s) from router to a view:
Route::get('about', function() {
$people = ['Eduardo', 'Paola', 'Chancho'];
return view('about')->with('people', $people);
});
Route::get('about', function() {
$people = ['Eduardo', 'Paola', 'Carlos'];
return view('about')->withPeople($people);
});
The second example, I am not sure how Laravel handle it. I know it works I have test it, but which pattern they use? why is it possible to handle a dynamic variable.
Thanks in advance for your help!