Laravel : Method [show] does not exist
Stefan Bogdanescu
Founder & Senior Architect · 2026-06-29
Title: Analyzing the Cause of Method [show] Error in Laravel App
Body:
When attempting to access the 'users/login' URL you got the error message "Method [show] does not exist." This can happen due to various reasons, but most commonly, it is a routing problem. In this blog post, we will dig deeper into your code and find potential causes for the issue.
1. Check Your Routes: Firstly, review the routes you have declared in `routes.php`. Make sure that there isn't any duplicate or conflicting route definition. Keep in mind that Laravel offers resourceful routing to simplify the process, but it may lead to unintentional conflicts. You could try removing the custom routes and using the resourceful route only.
- Remove the lines `Route::get('users/login', 'UserController@login');` from `routes.php`.
- Replace the current `UserController` code with this:
<?php
class UserController extends BaseController {
...
public function login()
{
return Redirect::action('UserController@showLogin');
}
...
- Modify your `routes.php` to include the new route definition:
<?php
Route::resource('users','UserController');
Route::get('/', function() {
return View::make('hello');
});
2. Refactor Your Controller Code: Check your controller code to find potential errors or inconsistencies. Replace the custom routes with resourceful routing.
- In your `UserController`, remove the custom route handling functions (`login()`) and replace it with a resourceful method (`showLogin()`).
<?php
class UserController extends BaseController {
...
public function index() {
...
}
...
protected function showLogin()
{
return View::make('users.login');
}
- Modify the `routes.php` accordingly:
<?php
Route::resource('users','UserController');
Route::get('/', function() {
return View::make('hello');
});
3. Verify Your Blade File: Ensure that your login view file (`resources/views/users/login.blade.php`) is properly structured and follows Laravel conventions for resourceful routes.
4. Check Your View File: Double-check the form action in your `users/login.blade.php` file. It should be pointing to the correct route for creating a new user (for example, 'users'). If it's incorrectly set, adjust as required.
5. Reconsider Your URL Structure: Lastly, think about whether you need to use `/login` in your application's structure or if you may have other ways of handling authorization and authentication. For example, using a middleware to enforce the login condition would be more secure than defining multiple routes for each action.
After implementing these recommendations, re-test your application to see if the error is resolved. If not, review your source code once again with a fine comb, or consider asking for further assistance in our community forums or hiring professional Laravel developers like [Laravel Company](https://laravelcompany.com).