Reputation: 71
What is the best way to bind multiple results to a view? The following does not work but it captures my logic:
public function show($id)
{
$nests = Nest::with('user')->find($id);
$notes = Note::with('nest')->where('nest_id', '=', $id);
return View::make('nests.show', compact('nests', 'notes'));
}
Upvotes: 1
Views: 3338
Reputation: 725
I used this code
return View::make('myviewfolder.myview', compact('view1','view2','viewN'));
I am using PHP 5.5
Here is the info on the compact function
Upvotes: 0
Reputation: 621
I think this will do it:
return View::make('nests.show',array('nests'=>$nests,'notes'=>$notes));
Upvotes: 1