You can protect your API routes by using middleware. In your use case that would be the auth middleware.
Example
Route::middleware('auth')->get('/routepath', [YourController::class, 'controllerMethod']);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi guys, as discussed in my other post ("Laravel inertia scope for client selection", I'm sadly not allowed to post links yet),
I would like to update my session based on a selection made in the frontend using inertia. As I'm new to inertia I'm looking for a best practice on how this could be done.
Just like in normal vue with using an axios? If yes, how would I secure the endpoint properly? Or is there some internal magic stuff from inertia I could use?
Thanks a lot in advance :)
Please or to participate in this conversation.