Z
Z
zzmaster2019-04-15 00:07:19
Laravel
zzmaster, 2019-04-15 00:07:19

Laravel: where to do common calculations for all routes?

Noob question, sorry.
Let's take a blog, in the left column there is a list of categories, it is the same for all blog pages. I am far from thinking that in each route function I need to read this list into the $categories variable in order to use it later in the template.
Middleware? But judging by the examples, this is for filtering requests.
So where should this be done ideologically correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2019-04-15
@zzmaster

https://laravel.com/docs/5.6/views#view-composers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question