R
R
RadionOdessa2020-11-02 20:01:33
Laravel
RadionOdessa, 2020-11-02 20:01:33

Outputting information from MySQL DB without controller call in Laravel?

Hello, I am displaying a list of my links (site pages) in the header
public function navlink(){
$pages = pages::all()->whereNotIn('url',['404','/']);
return view('layout.inc.header',['page'=>$pages]);
}
When entering the main page (Main + included header), empty data is not received in the header.
How to get data in the header without calling the controller in the route ???

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maddog670, 2020-11-02
@RadionOdessa

Via ViewComposer https://si-dev.com/ru/blog/laravel-view-composers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question