您好,我在一个项目中使用 laravel 4,这不是第一次,但我遇到了一个我以前从未遇到过的问题。
Some mandatory parameters are missing ("key") to generate a URL for route "register".
我不知道如何解决它我已经尝试了我想出的一切但没有结果。这些是我的路线:
Route::get('register/{key}',array('before'=>'guest','as'=>'register','uses' => 'UserController@create'));
Route::post('register/{key}',array('before'=>'csrf','uses'=>'UserController@store'));
我的控制器: class UserController extends BaseController {
public function getRegistro($key = null)
{
$invites = Invite::lists('key');
if (in_array($key, $invites)) {
return View::make('home.register')
->with('title','Register')
->with('key',$key);
}else{
Notification::error('Not a valid key to register.');
return Redirect::route('home');
}
}
public function postStore()
{
$validator = Validator::make(
array(
'username' => Input::get('username'),
'password'=>Input::get('password'),
'password_confirmation'=>Input::get('password_confirmation'),
'email'=>Input::get('email'),
'ubi'=>Input::get('ubi'),
'bio'=>Input::get('bio'),
),
array(
'username' => 'required|unique:users|',
'password'=> 'required|min:6|confirmed',
'password_confirmation'=> 'required|min:6',
'email'=> 'required|unique:users|email',
'ubi'=> 'required|min:5',
'bio'=>'required|min:10',
)
);
if ($validator->fails())
{
Notification::error($validator->messages());
return Redirect::route('register');
}else{
$user = new User;
$user->username = Input::get( 'username' );
$user->email = Input::get( 'email' );
$user->password = Input::get( 'password' );
$user->save();
}
当我发送一个空表单时会发生这个问题,但是当我输入信息时,例如我的用户名布鲁斯我得到这个错误:
Method [validateBruce] does not exist.
请帮忙