You can use
$this->request->only('key1', 'key2')
So you will only return the keys defined.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Good Day,
In the built-in Laravel Authentication/Registration function, the postRegister() method accepts a request with inputs from the form in register.blade.php. These inputs being:
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6',
I am able to register a user using the this function, however, I expanded and have other fields present e.g employed, qualification level for a profile, in my form that also require validation. The postRegister() method, further includes the line: Auth::login($this->create($request->all())); which logs a user in after successful registration. How do I exclude inputs from my request other than the ones stated above for this to be successful? Every time I try and do so, the other input fields present in my form can't seem to be found. Moreover, if i leave my request as is, I get the following error:
ErrorException in Guard.php line 430:
Argument 1 passed to Illuminate\Auth\Guard::login() must implement interface Illuminate\Contracts\Auth\Authenticatable, instance of Illuminate\Http\RedirectResponse given
, however, my user is created along with their profile.
On the other hand is there any way to override, remove or simply make the: Auth::login($this->create($request->all())); line not execute?
Regards, Mylo
You can override the postRegister() method on your Auth Controller.
There you can use your own logic.
//AuthController.php
public function postRegister()
{
//
}
Please or to participate in this conversation.