S
S
Skyper2021-08-10 21:08:14
Laravel
Skyper, 2021-08-10 21:08:14

I want to get the blade template (alerts.blade.php) through the controller. Is it necessary to create a route for this blade?

I want to get the blade template (alerts.blade.php) through the controller. Is it necessary to create a route for this blade, or can I somehow get it somehow? If so, how, and if not, what about the url? Let's prevent the situation so that a person accidentally or specifically follows the url where this piece of code lies?
I need it to get it via fetch

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel, 2021-08-10
@mrusklon

you can return a view through the controller

Route::get('/','[email protected]');




class ControllerName extends Controller
{
    public function index() {
        return view('alerts.index');
    }
}

from here to dance, that is, the route will be on the controller, and not on the blade itself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question