title: How to set custom redirect url in register in laravel?
body: <p>I overwrite register method in <code>RegistersUsers</code> Trait in <code>RegisterController</code> to this :</p>
  <pre><code>public function register(Request $request)
  {
      $request-&gt;validate([
          'name' =&gt; 'required|string|max:255',
          'username' =&gt; 'required|string|max:255|unique:users',
          'password' =&gt; 'required|string|min:8|confirmed',
          'phone_number' =&gt; [
              'required',
              'min:11',
              'max:11',
              Rule::unique('users')
          ]
      ]);
  
      $user = User::create([
          'name' =&gt; $request['name'],
          'password' =&gt; Hash::make($request['password']),
          'username' =&gt; $request['username']
      ]);
  
      $this-&gt;guard()-&gt;login($user);
  
      $code = ActiveCode::generateCode($user);
      $request-&gt;session()-&gt;flash('phone', $request['phone_number']);
      $request-&gt;session()-&gt;flash('auth', ['user_id' =&gt; $user-&gt;id]);
  
      $user-&gt;notify(new ActiveCodeNotification($code, $request['phone_number']));
  
      return redirect(route('register.token'));
  
  }
  </code></pre>
  <p>As you can see at the end i returned to a custom route, but after registering, it will redirect to <code>/home</code>.</p>
  <p>And this is <code>protected $redirectTo = '/';</code></p>
  <p>Why it can't redirect to <code>route('register.token')</code> ?</p>
  <p><strong>UPDATE</strong></p>
  <p>This is <code>register.token</code> route :</p>
  <pre><code>Route::get('/register/phone', 'Auth\RegisterController@showTokenForm')
  -&gt;name('register.token');
  </code></pre>
  <p>And this is <code>showTokenForm</code> method :</p>
  <pre><code>public function showTokenForm(Request $request)
  {
      $request-&gt;session()-&gt;reflash();
  
      return view('auth.register-token');
  }
  </code></pre>