web.php
use App\Http\Controllers\PagesController;
use Illuminate\Support\Facades\Route;
Route::get('/', PagesController::class, 'index');
Route::get('/test', PagesController::class, 'test');
PagesController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class PagesController extends Controller
{
public function index()
{
return view('invoices.index');
}
public function test()
{
return view('invoices.test');
}
}
Folder structure
views
invoices
index.blade.php
test.blade.php
layouts
app.blade.php
welcome.blade.php
Problem
When I run php artisan serve
and go to localhost:8000
I see the welcome.blade.php template and when I go to localhost:8000/test I get 404 not found.
I tried the following commands with no success.
php artisan cache:clear
php artisan route:cache