H
H
Harconnen2015-05-17 19:08:50
Laravel
Harconnen, 2015-05-17 19:08:50

How to add code blocks in Laravel?

Hello!
I'm learning Laravel recently, I used to write just in PHP.
The question is the following.
I use "Blocks" on the site. I create these blocks using PHP. (weather, anecdote of the hour, holiday)
I understand that it is not good to use such a block with php code inside the main template (layout.blade.php).
Enter such a block in the controller, but the blocks are the same, and there are several controllers.
Where in Laravel is it correct to place this php code and how to pass it to the blade.php template?
I hope I was able to describe the question correctly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tesla, 2015-05-18
@Harconnen

laravel.su/docs/5.0/views#view-composers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question