E
E
Edward2020-12-19 17:11:37
Laravel
Edward, 2020-12-19 17:11:37

How to connect the header controller in another controller in Laravel, for example, as it is implemented in OpenCart?

How to connect the header controller in another controller in Laravel, for example, as it is implemented in OpenCart?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ilya Chubarov, 2020-12-20
@agoalofalife

C opencart did not work, but in Laravel, connecting one controller to another sounds crazy.
You can create a parent and inherit from it.
But .. I highly do not recommend dragging approaches from opencart to Laravel.
Read the Laravel documentation (in English), then again.
After expanding your horizons, you will receive a solution to your tasks, but through Laravel tools.

E
Edward, 2020-12-20
@EdOther

I found a solution, but I don’t know if it is correct:
1. I created a HeaderController controller that inherits Controller
2. In the desired controller, I connect the header as new HeaderController(), and then I call the index method that returns the already prepared html
3. In the template {!! $header!!}

V
Vladimir Kudrya, 2021-01-19
@Mugenzo

https://laravel.com/docs/8.x/blade#components
Here are the components

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question