Problem with Laravel Routes 5

Asked

Viewed 436 times

1

I organized my Controllers by folders: Ex:Dashboard/Concessesionaria/Brands -> Carroscontroller.php

In Rota I tried to inform thus

Route::get('Painel\Concessesionaria\Marcas', ['as' => 'marcas', function () {

Route::get('marcas', 'MarcasController@index');
Route::post('marcas/view', 'MarcasController@view');
Route::post('marcas/add', 'MarcasController@add');
Route::post('marcas/delete', 'MarcasController@delete');
Route::post('marcas/edit', 'MarcasController@edit');
Route::post('marcas/update', 'MarcasController@update');

}]);

But you’re making the following mistake localhost:8000/locations

Notfoundhttpexception in Routecollection.php

  • Do I need to know which folder you’ve put this Dashboard/Dealerships in? Within App/Http/Controllers?

2 answers

2


The route local that you accessed is not registered, try to do this and access localhost:8000/brands

Route::group(['prefix' => 'marcas'], function () {

    Route::get('/', 'Painel\Concessesionaria\Marcas\MarcasController@index');
    Route::post('/view', 'Painel\Concessesionaria\Marcas\MarcasController@view');
    Route::post('/add', 'Painel\Concessesionaria\Marcas\MarcasController@add');
    Route::post('/delete', 'Painel\Concessesionaria\Marcas\MarcasController@delete');
    Route::post('/edit', 'Painel\Concessesionaria\Marcas\MarcasController@edit');
    Route::post('/update', 'Painel\Concessesionaria\Marcas\MarcasController@update');

});

0

The first parameter you are passing to the get method is not the folder of your controllers, you must pass as the first parameter p link of your route. For this reason we are returning this error.

So change on each route:

Route::get('marcas', 'Painel\Concessesionaria\Marcas\MarcasController@index');
  • It was like Raylan posted right below my routes were unregistered

Browser other questions tagged

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