I'm trying to add extra functionality to the registration portion of my Laravel application. I already ran
make:auth to get the basics up and running, and have modified the user_name field ever-so-slightly. But I'm having trouble going much beyond that.
Users will opt to register with one role (via either a radio or select input), from a list of several. The form will then display the relevant fields to that role. The extra fields will also be stored in one or more table completely separately from the user table.
It seemed like overwriting the
registered method from the
RegistersUsers trait would be the right approach to this, but I'm having some difficulty. I tried customising the
RegisterController like so:
class RegisterController extends Controller
protected $redirectTo = '/admin';
public function __construct()
protected function validator(array $data)
return Validator::make($data, [
'first_name' => 'required|string|max:255',
'last_name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
protected function create(array $data)
$user = User::create([
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
// try adding an image...
protected function registered(Request $request, $user)
'user_portrait' => 'required|mimes:jpeg,png|dimensions:min_width=800,max_width:1800|max:2048'
$this->saveAndResize( $request->user_portrait, $user->id );
However this always attempts a redirect to the home route (which doesn't exist) for some reason. The user is created, but it never gets as far as adding the image - and I'm not even sure if this is the right place for the logic to go. Am I on the right tracks?