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 Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;
use App\Http\Controllers\ViewController;
/*
|--------------------------------------------------------------------------
| 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');
routes/web.php
file. There you should define, that your/dashboard
route should not use theauth
middleware. – codedgeroutes/web.php
file. We need to see the groups and middlewares applied to the route. – codedge