Answer the question
In order to leave comments, you need to log in
How to eliminate duplicate code with passing variables to blades in controllers?
The bottom line is this: the site has a header, which in fact does not change when switching between pages, and it only has a select in which you can change the language of the site. the names of languages are pulled from the database. The problem is that each time I go to a new page in each controller, I need to create a variable with languages and pass a blade. The problem can be in curve splitting of a template on blades? How can the problem be solved?
Answer the question
In order to leave comments, you need to log in
for this use view composers
https://scotch.io/tutorials/sharing-data-between-v...
at the dock
$lang = ['ru','en'];
view()->share('lang',$lang);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question