Problems accessing show method in root of Laravel

0

I'm studying Laravel and in parallel creating some projects, but I'm debating with some problems, when I'm calling the show(); method

Example controller:

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

The index method is called without problems, loading a listing that I created on its respective blade.

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

Example url:

http://127.0.0.1:8000/1

Error code:

NotFoundHttpException in RouteCollection.php line 179:

Error Image:

The strange thing is 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 is there any way I can call the show(); method at the root of my project?

    
asked by anonymous 14.05.2017 / 17:49

1 answer

0

When you use this URL in laravel: " link " he understands that you are calling the show method, this happens automatically. "

When you simply send without anything, he understands that you are administering the request " link "

In your routes.php file, you are only modifying the controller and calling no function ...

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

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

    
15.05.2017 / 21:37