Hi there! That's probably not the way you want to use filters. Let's take a look on what the docs say about filters
Route filters provide a convenient way of limiting access to a given route, which is useful for creating areas of your site which require authentication.
You would like to see route filters as a way to control access to your routes and not as a way to process tasks related to your business logic.
What you are probably seeking for is View::share()
. This method allows you to share data across all of your views.
$sys_message = DB::table('u_message')->where('uid','=','0')->get();
View::share('sys_message', $sys_message);
That's one way to make your data available in all of your views.
However, a much cleaner way would be for example using controllers with inheritance. But for smaller projects you can stick to View::share()
without hesitation.
Happy Coding!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community