Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
614 views
in Technique[技术] by (71.8m points)

Laravel Jetstream Inertia non authorised route

I have a fairly stock install of the Laravel, jetstream inertia js setup as shown here https://jetstream.laravel.com/2.x/installation.html using command php artisan jetstream:install inertia --teams

I want to show the dashboard to non logged in users. I am using a route without the auth:sanctum', 'verified' middleware, and trying to get the controller to set up the data that the inertia stack needs to fire up when the user IS logged in:

public function getPageDashboard(){
     return Inertia::render('Dashboard', [
        'user' => Auth::user()
     ]);
}

but I'm getting a lot of errors from the front end. "Error in render: "Error: Ziggy error: 'team' parameter is required for route 'teams.show'.""

Basically sanctum? jetstream? inertia? ziggy? sets up a lot of stuff somewhere in the middleware that I have not figured out.

Any ideas on my approach here?

Edit: Here is the web route file:

<?php

use IlluminateFoundationApplication;
use IlluminateSupportFacadesRoute;
use InertiaInertia;

use AppHttpControllersViewController;


/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


Route::get('/dashboard', [ViewController::class, 'getPageDashboard'])->name('dashboard');



question from:https://stackoverflow.com/questions/65909061/laravel-jetstream-inertia-non-authorised-route

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to reply this article.

OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...