I'm new to Laravel and I don't know what I am missing here. I have this in web.php
<?php
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('welcome');
});
Route::get('/Pages', 'PagesController@index');
My PagesController.php is
<?php
namespace App\Http\Controllers;
class PagesController
{
public function index()
{
echo 'Hello World';
}
}
PagesController exists inside Http/Controllers file, but I get an error that says "Target class [PagesController] does not exist" when I go to /Pages. I definitely not have a typo in the class name and I have searched for solutions but nothing worked. Can anyone give me advice on how to fix this?