I'm trying to create a CRUD application using Laravel and vue.js, but I keep running into problems. When I run the application it goes to the dashboard but the CRUD operations don't show up. The following is the Routes/web.app code:
<?php use Illuminate\Foundation\Application; use Illuminate\Support\Facades\Route; use Inertia\Inertia; use App\Http\Controllers\PostController; /* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | 这里是您可以为应用程序注册Web路由的地方,这些路由由RouteServiceProvider在一个包含“web”中间件组中加载。现在创建一些伟大的东西! | */ Route::get('/', function () { return Inertia::render('Welcome', [ 'canLogin' => Route::has('login'), 'canRegister' => Route::has('register'), 'laravelVersion' => Application::VERSION, 'phpVersion' => PHP_VERSION, ]); }); Route::get('/dashboard', function () { return Inertia::render('Dashboard'); })->middleware(['auth', 'verified'])->name('dashboard'); require __DIR__.'/auth.php'; Route::resource('Posts', PostController::class);
P粉8777196942024-04-01 00:23:05
I think I get it, you will be logged in before so when you try to run your app it will take you to the dashboard.
solution: You should make sure to clear all cache/session data and then run php artisan serve,
Hopefully now it will take you to the / => Welcome page!
(If not) You need to check the following points: