Laravel提交按钮重新路由到主页

So I used the default Registration Form Laravel.

Made copy of the Registration Form to make a slightly different one.

Basically there is two sign up forms

  1. Starter - original

  2. Bronze - Copy

--My Routing List--

Auth::routes();
Route::get('/register', function(){
  return View::make('auth.register');
});

Route::get('/bronze', function(){
  return View::make('auth.bronze');
});

Route::get('/login', function(){
  return View::make('auth.login');
});

Now every time I submit the bronze sign up form, it redirects me to my home page.

I'm thinking maybe its my Action call in my view. which is identical to the Starter Form

<form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}">

if I'm correct what I just did is bad practice, but I'm a new-bie at this framework.

You need to explicitly add a POST route, as the Auth::routes() method only handles calls to /register:

Route::post('/bronze', 'Auth\RegisterController@register');

And make sure you submit the Bronze form to the same route:

<form class="form-horizontal" role="form" method="POST" action="/bronze">

Alternatively, and possibly a better solution, would be to just use the same registration form and have an input for their account type selection:

<form class="form-horizontal" role="form" method="POST" action="/register">

    <input type="radio" name="type" id="type-starter" value="starter">
    <label for="type-starter">Starter</label>

    <input type="radio" name="type" id="type-bronze" value="bronze">
    <label for="type-bronze">Bronze</label>

Old question but had a similar issue.

Don't forget to include csrf token in all your forms if you have that middleware enabled.

These days it's as simple as calling a blade helper:

<form action="..." method="...">
    @csrf
    ...
</form>