B
B
BarneyGumble2018-07-22 23:33:22
Laravel
BarneyGumble, 2018-07-22 23:33:22

How to set a route in Laravel for all pages except the main one?

Good evening
For the main page in Laravel, there is a simple route:

Route::get('/', function () {
    return view('main');
});

I have an inner template that should be included on all pages except the main one. How to register a route for it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yan-s, 2018-07-23
@Yan-s

No way. A route is a logic connection with what is in the address bar.
If you need to display something in the general template everywhere except the main one, it would be logical to place in it a conditional section that is not displayed on the main page.

K
Kairat Ubukulov, 2018-08-15
@ubukulov

Route::get('/', function () {
    return view('main');
});

// для всех остальных страницы через группы пишешь 
Route::group();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question