I am getting the following error in my Laravel application at http://127.0.0.1:8000/user
.
Please understand, this is my first ever Laravel application.
Illuminate\Contracts\Container\BindingResolutionException Target class
[UserController] does not exist.
When I am trying the following code in web.php Route::get('/user', 'UserController@index');
.
UserController file:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UserController extends Controller
{
public function index()
{
return 'Hellow dear user!';
}
}
However, this works.
Route::get('/user', function(){
return view('user');
});
The migration was ran and the tables are successfully created in the database.
Environment:
OS: XAMPP on Windows 10
Laravel version: 8.5.0
Laravel locale: en
Laravel config cached: false
PHP version: 7.4.3
The full error report is shared at Flare