Use
return redirect()->with(array $data);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
After a user has just registered, I need to place a cookie on the /home page of the app, but it must only appear once, on succesful registration.
The approach I have used is to have setting in my app/config of 'justRegistered' => 'false',, then create an event attached to EventServiceProvider with
'Laravel\Spark\Events\Auth\UserRegistered' => [
'Laravel\Spark\Listeners\Subscription\CreateTrialEndingNotification',
'App\Events\SendWelcomeEmail',
'App\Events\JustRegisteredTracking',
],
the handle of the event has:
public function handle(UserRegistered $userRegistered)
{
\Config::set('app.justRegistered', 'true');
}
which changes the 'false' to 'true'
lastly, in my blade layout I have the following
@if (Config::get('app.justRegistered')=='true')
// some stuff
@endif
The problem is that the setting doesn't change, and stays at false. I have checked that the event is firing correctly on registration, which it seems to be, but the blade template is not picking up on the change.
Any ideas why? Or a simpler approach?
Please or to participate in this conversation.