调用未定义的方法Illuminate \ Support \ Facades \ Validator :: resolver() [英] Call to undefined method Illuminate\Support\Facades\Validator::resolver()

查看:164
本文介绍了调用未定义的方法Illuminate \ Support \ Facades \ Validator :: resolver()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Laravel 5.2并通过运行以下命令来更新作曲家

I am using Laravel 5.2 and update the composer by running the following command

composer require felixkiss/uniquewith-validator:2.*

,然后将以下内容添加到config/app.php中的providers数组中:

and then added the following to your providers array in config/app.php:

'providers' => array(
    // ...

    'Felixkiss\UniqueWithValidator\UniqueWithValidatorServiceProvider',
),

之所以这样做,是因为我试图实现多列唯一验证.我的意思是复合密钥验证.

I did this because I am trying to implement Multiple column Unique Validation. I mean Composite Key Validation.

Laravel运行以下行时.

When Laravel runs the below line.

public function store(Request $request)
{
    $v = \Validator::make($request->all(), [
        'SubCategory' => 'required|max:25|min:5|unique_with:tblsubcategory,CategoryID',
        'CategoryID' => 'required',
    ]);

    if ($v->fails()) {
        return \Redirect::back()
                    ->withErrors($v)
                    ->withInput();
    }
    return Redirect('/SubCategories-List/'.$request->input('CategoryID'));
}

我收到此错误.

UniqueWithValidatorServiceProvider.php 27行中的FatalErrorException:调用未定义的方法 照亮\支持\外观\验证器:: resolver()

FatalErrorException in UniqueWithValidatorServiceProvider.php line 27: Call to undefined method Illuminate\Support\Facades\Validator::resolver()

重要

在Laravel 5.1中运行正常

Important

This was working fine in Laravel 5.1

推荐答案

存在完全相同的问题,尽管当我运行php artisan命令时出现以下错误类验证器不存在

Having the exact same problem, although when I run php artisan commands I get the following error Class validator does not exist

试图弄清楚现在发生了什么

Trying to work out whats going on now

-修复(针对我的问题)-

-- Fixed (for my problem) --

将您的作曲家json更新到此版本...

Updated your composer json to this version ...

"felixkiss/uniquewith-validator":"2.0.3"

"felixkiss/uniquewith-validator": "2.0.3"

并删除Whoops,因为它似乎捕获了 HttpResponseException ,升级文档确实指出了该问题可能会导致问题.

and remove Whoops, as that seems to catch the HttpResponseException of which the upgrade docs do say could cause issues.

这解决了我的问题.

这篇关于调用未定义的方法Illuminate \ Support \ Facades \ Validator :: resolver()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆