You have to share the session variable on each request.
See example in docs here: https://inertiajs.com/shared-data#flash-messages
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
class CourseController extends Controller
{
public function store(Request $request)
{
return redirect()->route('courses.all')->withFragment('paid');
}
}
The above code is working without inertia. but is there any method to do the same with inertia?
This is still currently not possible in Inertia but there is a decent workaround in the GitHub issues:
https://github.com/inertiajs/inertia/issues/729#issuecomment-1462213060
Works great for me, you can even use composables if you need to re-use it across multiple pages.
Please or to participate in this conversation.