SQL query on all pages in Laravel?

Hello. Need your help.

There is a site on Laravel 5.2. The structure is this:
  1. navbar
  2. content

    content (the only thing that changes on each page)

  3. footer

I need to in the sidebar displayed the nicknames of the most active users. The problems with constructing a query there, but how to make this query visible on all pages, as it is a side-bar. Or an array that will return the query to be available on all pages.

PS: I Use Blade.

Thank you.
July 8th 19 at 15:45
1 answer
July 8th 19 at 15:47
Thank you. And where better to describe the logic to get the array? At the moment you wrote it routes.php everything works. But I think that's not quite right.

$best_developers = \App\Task::where('status', '1')........;
View::share('best_developers', $best_developers); - Maryjane97 commented on July 8th 19 at 15:50
The link there is an example... - aniya commented on July 8th 19 at 15:53
: Yes, indeed, I did not notice. Thanks again. - Maryjane97 commented on July 8th 19 at 15:56

Find more questions by tags Laravel