bigboichuverloo2
1 year ago

redirectTo , to make it redirect to the same page .

Posted 1 year ago by bigboichuverloo2

In my registers controller i want my registration to redirect on the same page (auth/register.blade.php). How do i do that ?

Here's my code :

class RegisterController extends Controller {

use RegistersUsers;

/**
 * Where to redirect users after registration.
 *
 * @var string
 */
protected $redirectTo = '\home';

/**
 * Create a new controller instance.
 *
 * @return void
 */
public function __construct()
{
    // $this->middleware('guest');
}

/**
 * Get a validator for an incoming registration request.
 *
 * @param  array  $data
 * @return \Illuminate\Contracts\Validation\Validator
 */
protected function validator(array $data)
{
    return Validator::make($data, [
        'name' => 'required|string|max:255',
        'email' => 'required|string|email|max:255|unique:users',
        'password' => 'required|string|min:6|confirmed',
    ]);
}

/**
 * Create a new user instance after a valid registration.
 *
 * @param  array  $data
 * @return \App\User
 */
protected function create(array $data)
{
    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'address' => $data['address'],
        'age' => $data['age'],
        'birthday' => $data['birthday'],
        'senior_citizen_id' => $data['senior_citizen_id'],
        'user_type' => 3,
        'password' => Hash::make($data['password']),
    ]);
}

}

Please sign in or create an account to participate in this conversation.