I can’t access the route controller on Laravel 5.8

Asked

Viewed 85 times

0

I can’t access the Laravel controller when I use:

Route::controller('categorias', 'CategoryController');

He makes the following mistake:

Invalidargumentexception Attribute [controller] does not exist.

However if I make another type of route:

Route::get('/about', 'CategoryController@store'); /(here he goes normally)/

What would be the problem?

  • Depending on the version you can use Route::resource('name', '<controller>') https://laravel.com/docs/5.8/controllers#Resource-controllers

  • This helped, but how could you pass only one controller on the route and be able to identify the types of HTTP requests (get, post, put, delete, options), that is, by setting in the Controller itself.

  • 1

    I could give an example?

  • 1

    I believe you are talking about this: https://stackoverflow.com/questions/23505875/laravel-routeresource-vs-routecontroller

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.