D
D
DocTypeMaster2021-02-11 15:49:59
Laravel
DocTypeMaster, 2021-02-11 15:49:59

How to do static data output from the database to the page in laravel?

Suppose there are several inclubs with different blades on the page, each of them is a separate module with services or some kind of feedback, so tell me how can I get data from the database and display them for these different blades?

It's just that, as I understand it, you need to run the output function for all data at once when switching to "/"? But how to scatter them over different blades when? Or tell me how it's generally done correctly?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey delphinpro, 2021-02-11
@delphinpro

In general, nothing is clear.
But in general, just get the data and pass it to the view

return view('index', [
  param1 => '',
  param2 => '',
  param3 => '',
])

all views that are connected by includes will receive this data.
If not, please explain what you want.

A
alex--n, 2021-02-11
@alex--n

As an option
- create a base controller
- create a method in the base controller that will call render
- call a method from the base controller in ordinary controllers, sending parameters
- in the base already cram parameters for everything else
So, in principle, you can not write data pull-up that will be for all pages in each controller, and pull in only one.
In general, it is advisable not to paint all this stuff in a blade, but to pull the api with the data and place it on the front.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question