R
R
Roman2019-11-15 11:08:41
Laravel
Roman, 2019-11-15 11:08:41

Is it possible [without crutches] to generate a controller name in routes dynamically depending on the URI?

For example: to have something like (this code DOES NOT work))) just not to write a lot of letters:
Route::get('/profile', '[email protected]');

Route::get('/profile/{type}', 'Profile'.$type.'[email protected]');

Can this be done within LaravelWay? :)
I didn't find how.
//I want to make a universal route to several controllers, so as not to make a sheet))

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman, 2019-11-15
@procode

In short, there is no tailless solution at all, did I understand correctly?
Ok, a negative result is also a result :)

K
Konstantin B., 2019-11-15
@Kostik_1993

There will be a limited number of controllers! No more no less. So what's the problem with writing routes for them?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question