public function registerUser(Request $request) { if ($request->input('user') == 'passenger') { $user = new Passenger(); $user->firstName = $request->input('firstName'); $user->lastName = $request->input('lastName'); $user->nic = $request->input('nic'); $user->contactNo = $request->input('contactNo'); $user->password = $request->input('password'); $user->savePassenger($user); } elseif ($request->input('user') == 'driver') { $user = new Driver(); $user->firstName = $request->input('firstName'); $user->lastName = $request->input('lastName'); $user->contactNo = $request->input('contactNo'); $user->password = $request->input('password'); $user->saveDriver($user); } }