Vuk Stanković Vuk Stanković - 24 days ago 6x
PHP Question

Correct way of adding additional routes to resource controller

I was wondering if there is a more elegant or in any way "correct" way of adding additional routes to resource controller?

For instance I could have

and route it with

Route::resource('users', 'UserController');

And it will route methods according to Laravel docs

But if for any reason I wanted to add a method outside of this scope I could do something like

Route::get('users/token', 'UserController@authToken');

So obviously this works, but is there another way of doing this?


No, there is no better way to do that. Since ::controller was deprecated, you should explicitly declare each additional route.