The way I would do it
如果您的表单是(2个按钮):
{{ Form::open(array('url' => 'test/auth')) }}
{{ Form::email('email') }}
{{ Form::password('password') }}
{{ Form::password('confirm_password') }}
<input type="submit" name="login" value="Login">
<input type="submit" name="register" value="Register">
{{ Form::close() }}
Create a controller 'TestController'
添加路由
Route::post('test/auth', array('uses' => 'TestController@postAuth'));
In TestController you'd have one method that checks which submit was clicked on and two other methods for login and register
<?php
class TestController extends BaseController {
public function postAuth()
{
//check which submit was clicked on
if(Input::get('login')) {
$this->postLogin(); //if login then use this method
} elseif(Input::get('register')) {
$this->postRegister(); //if register then use this method
}
}
public function postLogin()
{
echo "We're logging in";
//process your input here Input:get('email') etc.
}
public function postRegister()
{
echo "We're registering";
//process your input here Input:get('email') etc.
}
}
?>