I have a route group defined like so:
Route::group(['middleware' => 'auth'], function(){
Route::get('/app', function () {
//return the view...
});
Route::get('/calc', function () {
//return the view...
});
Route::get('/fries', function () {
//return the view...
});
});
And I want to be able to pass in the user's notifications to all of these views with something like:
Notifications::all()->where('for', '=', Auth::user()->id);
I'm using Laravel 5.4, and I can't find any info for this online surprisingly. I have only come across ViewServiceProviders which I dont think is what I'm looking for.
Is it as simple as adding ->with(...)
to the end of my route group?
Thanks!
via Vranvs