0

How do you pass a parameter from Livewire PHP page and redirect to register.blade view? I'm using build in Laravel login and register template and I need to populate the email address field on the register page. I'm using Laravel 8 with Jetstream...

"return redirect('register',['email'=>$this->email]);
Anatoly
  • 20,799
  • 3
  • 28
  • 42
  • `return redirect('register')->withInput()` will allow you to use `old('email')` in your view and have the value you entered. Or, `$request->flashOnly(['email'])` will allow `old('email')` to be available, for 1 request. Is that what you're looking for? Or something else? It's in the documentation, for reference: https://laravel.com/docs/8.x/requests#old-input – Tim Lewis Jan 04 '21 at 22:02
  • Thank you for your help Tim, but I'm getting this error "Method Livewire\Redirector::withInput does not exist." I'm new to livewire and jetstream. What I'm working on is send an email to the users, and when they click on the link from the email, it will go to the registration page with their email populated in the email input field. – Dave Ngo Jan 05 '21 at 03:02
  • Never used Livewire, so not sure about that. But if they're clicking a link in an email, you'll likely need to get the email from the request query string (`?email=whatever`), then `$email = $request->input('email')`, then `return view('whatever')->with(['email' => $email])` (or similar). Not sure why you're redirecting at all TBH. – Tim Lewis Jan 05 '21 at 03:07
  • 1
    I think there is a restriction on how you can pass parameters in livewire and jetstream. I think I will just use the normal controller and blade view... Thank you and again for your help Tim! have a great day! – Dave Ngo Jan 05 '21 at 03:22

0 Answers0