Laravel路由返回空白页


Laravel Routing returns blank page

使其略短。我刚刚制作了一份登记表,与管制员、路线和视图充分合作。现在,我知道使用Model来实现它是常识,并且在控制器中只调用模型中的方法。所以我想好吧,让我们解决这个问题。现在,当我注册一个帐户时,我会得到一个空白页面。我打赌重定向出了问题,但我无法修复,也许你可以?

RegisterController.php

public function doRegister(){
    $user = new User();
    $user->doRegister();
}

User.php(型号)

public function doRegister()
{
    // process the form here
    // create the validation rules ------------------------
    $rules = array(
        'username'             => 'required|unique:users',
        'email'            => 'required|email|unique:users',
        'password'         => 'required|min:5',
        'serial_key'            => 'required|exists:serial_keys,serial_key|unique:users'
    );
    // create custom validation messages ------------------
    $messages = array(
        'required' => 'The :attribute is important.',
        'email'  => 'The :attribute is not a legit e-mail.',
        'unique' => 'The :attribute is already taken!'
    );
    // do the validation ----------------------------------
    // validate against the inputs from our form
    $validator = Validator::make(Input::all(), $rules);
    // check if the validator failed -----------------------
    if ($validator->fails()) {
        // get the error messages from the validator
        $messages = $validator->messages();
        // redirect our user back to the form with the errors from the validator
        return Redirect::to('/register')
            ->withErrors($validator)
            ->withInput(Input::except('password', 'password_confirm'));
    } else {
        // validation successful ---------------------------
        // our duck has passed all tests!
        // let him enter the database
        // create the data for our duck
        $duck = new User;
        $duck->username = Input::get('username');
        $duck->email = Input::get('email');
        $duck->password = Hash::make(Input::get('password'));
        $duck->serial_key = Input::get('serial_key');

        // save our user
        $duck->save();
        // redirect with username ----------------------------------------
        return Redirect::to('/registered')->withInput(Input::old('username'));
    }
}

您需要使$user->doRegister();返回语句

在您的RegisterController中,您必须执行

public function doRegister(){
$user = new User();
return $user->doRegister();
}

尝试这个

return Redirect::to('/registered')
            ->with('bill_no', Input::get('username'));

在"/已注册"控制器中,。。使用这个

$username = Session::get("username");

上面为我工作,。。。