kevinwakhisi's avatar

Route Group with inertia

i am trying to group my routes using jetstream but when i tried to make the first group i got an error stating that the class wasn't found

 Class 'Inertia\Inertia\Inertia' not found
http://127.0.0.1:8000/dashboard 

my script is as follows

Route::group(['middleware' => ['auth:sanctum', 'verified']], function () {
    Route::get('/dashboard', function () {
        return Inertia\Inertia::render('Dashboard')->name('dashboard'); 
    });
    
});

I would appreciate it if some would solve this

0 likes
4 replies
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

I assume you have imported Inertia at the top ( use Inertia\Inertia )

Then just do this

Route::group(['middleware' => ['auth:sanctum', 'verified']], function () {
    Route::get('/dashboard', function () {
        return Inertia::render('Dashboard'); 
    })->name('dashboard'); //name goes here
    
});
kevinwakhisi's avatar
 Call to undefined method Inertia\Response::name()
http://127.0.0.1:8000/dashboard 

this is the error i am getting now

Sinnbeck's avatar

Ah sorry just noticed the error. Updated my answer!

Please or to participate in this conversation.