I'm trying to pass two sets of variables into my View and failing miserably...
I need to pass two entities into my view. Both of which work fine when I retrieve them one at at time, but I'm blowing it somewhere when I try to do both.
Here's the function I'm wrestling with in my Controller and my attempt to pass both sets of data into my route simultaneously:
public function professionals($id) { $pages = Page::findOrFail($id); $pros = Professional::sortable()->orderBy('lname', 'asc')->paginate(25); return view('pros', compact('pros'))->with('pages', compact('pages')); }
Open in new window
Why compact() - are you sure that does what you think it does?Why not jus
Open in new window
NB
Just focusing on the $pros data for now - not sure that the compact('pages') is right either.