升级到Laravel 5.1 - 方法[验证器]不存在

时间:2015-06-10 07:18:32

标签: laravel laravel-5

昨晚,我将应用程序从5.0升级到5.1。

除注册外,一切似乎都运转良好。

在输入信息和注册时,我收到此错误:

BadMethodCallException in Controller.php line 282:
Method [validator] does not exist.

无法确定我在哪里解决此问题。

RegistersUsers.php

    namespace Illuminate\Foundation\Auth;

    use Illuminate\Http\Request;
    use Illuminate\Support\Facades\Auth;
    use App\Services\Registrar;

    trait RegistersUsers
    {
        use RedirectsUsers;

    public function postRegister(Request $request)
        {
            $validator = $this->validator($request->all());

            if ($validator->fails()) {
                $this->throwValidationException(
                    $request, $validator
                );
            }

            Auth::login($this->create($request->all()));

            return redirect($this->redirectPath());
        }
}

Controllers.php

public function __call($method, $parameters)
    {
        throw new BadMethodCallException("Method [$method] does not exist.");
    }

1 个答案:

答案 0 :(得分:9)

您是否阅读了upgrade docs

您需要从validator()获取create()Services/Registrar.php并将其放入Controllers/Auth/AuthController.php。这就是字面意思。