Problems accessing show method at the root of Laravel

Asked

Viewed 181 times

0

I am studying Laravel and in parallel creating some projects, however I am struggling with some problems, when I am calling the method show();

Example the controller :

Route::resource('/', 'TEstController');

The index method is called without problems, loading a list that I created in your respective Lade.

Bear when I call method show(); passing a second parameter in the URL simply returns me the error:

Example of url:

http://127.0.0.1:8000/1

Error code:

NotFoundHttpException in RouteCollection.php line 179:

Error image:

Erro no navegador

The strange thing that when I call the show() method; inside a sub directory it works without any problem.

Example:

http://127.0.0.1:8000/test/1

Controller:

Route::resource('/test', 'TEstController');

Now comes the doubt There’s some way I can call the method show(); at the root of my project?

1 answer

0

When you use the URL of this line in the Standard: "http://127.0.0.1:8000/test/1" he understands that you are calling the show method, it happens automatic.

When you simply rule with nothing he understands that you are administering the requisition "http://127.0.0.1:8000/"

in your Routes.php file is just typing the controller and not calling any function...

Create the function in the controller and call it on route.

Route::Resource('/', 'Testcontroller@funcao');

  • I created the Route::Resource('/', 'Testcontroller@show') function; and passed the parameter at the root and with no result, the same error.

Browser other questions tagged

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