1 year ago

Company Change at nav level

Posted 1 year ago by dan3460

I have users that can enter information for different companies on a application. So i put a dropdown at the nav level which can be filled (foreach loop) from the controller that calls the index.blade, with something like this:

$companies = Assignment::where('id',Auth::user()->id)->get()

return view(user.index, compact('companies')

I have not tried it yet, but i think it should work. My question is: every time that i call a new view from a different controller, i will need to add the $companies and pass it to the view. Is there like a global way to do this?

Please sign in or create an account to participate in this conversation.