I have this site and one of its pages creates a simple list of people from the database. I need to add one specific person to a variable I can access.
How do I modify the return $view->with('persons', $persons);
line to also pass the $ms variable to the view?
function view($view)
{
$ms = Person::where('name', 'Foo Bar');
$persons = Person::order_by('list_order', 'ASC')->get();
return $view->with('persons', $persons);
}
Just pass it as an array:
$data = [
'name' => 'Raphael',
'age' => 22,
'email' => 'r.mobis@rmobis.com'
];
return View::make('user')->with($data);
Or chain them, like @Antonio mentioned.