我正在使用Builder插件来创建插件,并在我的一个插件中的模型中进行了字段验证,效果很好。
假设我在一个名为Team的插件中进行了类似的验证。
模型文件:technobrave\team\models\Team.php
<?php namespace Technobrave\Team\Models;
use Model;
/**
* Model
*/
class Team extends Model
{
use \October\Rain\Database\Traits\Validation;
/*
* Validation
*/
public $rules = [
'name' => 'required|unique:technobrave_team_',
'photo' => 'required',
'description'=>'max:1000',
'position' => 'required',
'phone' => 'required',
'mobile' => 'required',
'email' => 'required|email|unique:technobrave_team_',
'website' => 'url',
];
public $customMessages = [
'name.required' => 'Please enter team member name',
'name.unique' => 'This team member name already exists',
'photo.required' => 'Please select team member photo',
'description.max' => 'Please enter maximum 1000 characters for description',
'position.required' => 'Please enter team member position',
'phone.required' => 'Please enter team member phone number',
'mobile.required' => 'Please enter team member mobile number',
'email.required' => 'Please enter team member email address',
'email.email' => 'Please enter valid team member email address',
'email.unique' => 'This email address already exists',
'website.url' => 'Please enter valid team member url',
];
}
这工作得很好,我可以看到验证,但它们一个接一个地出现。相反,我希望他们一次全部出现。对于所有领域。
这可能吗 ?我怎样才能做到这一点?
谢谢