我试图从我的Laravel 5.6迁移到Laravel 5.8,尽管在我注入CustomValidator类时,Appservice似乎有一个错误,
这是我的 CustomValidator.php 类
import csv
import os
import glob
import numpy
import pandas as pd
import cv2 as cv
#cv.__version__ (= 4.10)
csv_files_path = r"...\annotations"
image_files_path = r"...\images"
result_files_path = r"...\image_output"
read_files = glob.glob(os.path.join(csv_files_path,"*.csv"))
for files in read_files:
image_data = pd.read_csv(files, header=0)
image_data
然后是我的 AppServiceProvider.php
namespace App\Laravel\Services;
use App\Laravel\Models\User as Account;
use Illuminate\Validation\Validator;
use Auth, Hash,Str,Input;
class CustomValidator extends Validator {
public function validateUniqueUsername($attribute,$value,$parameters){
$account_id = (is_array($parameters) AND isset($parameters[0]) ) ? $parameters[0] : "";
$username = Str::lower($value);
$is_exist = Account::whereRaw("LOWER(username) = '{$username}'")
->first();
return $is_exist ? FALSE: TRUE;
}
}
请考虑在我的customvalidator中我为自己的平台创建了很多自定义验证器。
我收到这种错误。