-
Hi guys, I have got a few data that needs to be included on every page, I tried using What I want is very similar to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @Aniket-IN use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;
class ExampleController
{
public function __invoke(Request $request): Response
{
return Inertia::render('Example', [
'onlyOnInitialVisit' => !$request->inertia() ? 'Hello World' : null,
]);
}
} |
Beta Was this translation helpful? Give feedback.
Hey @Aniket-IN
you can check for Inertia's Header - it will only be there on an Inertia vist. Initial visits do not contain the header. This way you can achieve the desired "load once" behaviour, e.g.