Commit b1a91d40 by lujunyi

唯一验证

parent 67644af6
...@@ -110,6 +110,12 @@ protected function form() ...@@ -110,6 +110,12 @@ protected function form()
$form->text('name')->width(4)->required()->maxLength(32, '最多输入32个字符'); $form->text('name')->width(4)->required()->maxLength(32, '最多输入32个字符');
$form->text('id_card')->width(4)->required(); $form->text('id_card')->width(4)->required();
$form->mobile('mobile')->width(4)->rules('required|regex:/^1[3456789]\d{9}$/')->required(); $form->mobile('mobile')->width(4)->rules('required|regex:/^1[3456789]\d{9}$/')->required();
$form->mobile('mobile')->width(4)->required()->rules(function (Form $form) {
// 如果不是编辑状态,则添加字段唯一验证
if (! $id = $form->model()->id) {
return 'unique:App\Models\DoctorModel,mobile';
}
});
$form->text('license_no')->width(4)->required()->maxLength(30, '最多输入30个字符'); $form->text('license_no')->width(4)->required()->maxLength(30, '最多输入30个字符');
$form->image('license_no_pic')->accept('jpg,png,jpeg')->uniqueName()->autoUpload()->retainable()->removable(false)->width(4)->required(); $form->image('license_no_pic')->accept('jpg,png,jpeg')->uniqueName()->autoUpload()->retainable()->removable(false)->width(4)->required();
$form->text('license_no_period')->width(4); $form->text('license_no_period')->width(4);
......
...@@ -143,7 +143,12 @@ protected function form() ...@@ -143,7 +143,12 @@ protected function form()
$form->text('name')->width(4)->required()->maxLength(32, '最多输入32个字符'); $form->text('name')->width(4)->required()->maxLength(32, '最多输入32个字符');
$form->text('id_card')->width(4)->required()->maxLength(18, '最多输入18个字符'); $form->text('id_card')->width(4)->required()->maxLength(18, '最多输入18个字符');
$form->text('license_number')->width(4)->required()->maxLength(32, '最多输入32个字符'); $form->text('license_number')->width(4)->required()->maxLength(32, '最多输入32个字符');
$form->mobile('mobile')->width(4)->required()->rules('required|regex:/^1[3456789]\d{9}$/'); $form->mobile('mobile')->width(4)->required()->rules(function (Form $form) {
// 如果不是编辑状态,则添加字段唯一验证
if (! $id = $form->model()->id) {
return 'unique:App\Models\PharmacistModel,mobile';
}
});
$form->image('practicing_license')->accept('jpg,png,jpeg')->uniqueName()->autoUpload()->retainable()->removable(false)->width(4)->required(); $form->image('practicing_license')->accept('jpg,png,jpeg')->uniqueName()->autoUpload()->retainable()->removable(false)->width(4)->required();
$form->date('practicing_license_expired_time')->width(4)->required(); $form->date('practicing_license_expired_time')->width(4)->required();
$form->image('physician_license')->accept('jpg,png,jpeg')->uniqueName()->autoUpload()->retainable()->removable(false)->width(4)->required(); $form->image('physician_license')->accept('jpg,png,jpeg')->uniqueName()->autoUpload()->retainable()->removable(false)->width(4)->required();
......
...@@ -124,7 +124,12 @@ protected function form() ...@@ -124,7 +124,12 @@ protected function form()
$form->image('pre_packaged_food')->accept('jpg,png,jpeg')->uniqueName()->autoUpload()->retainable()->removable(false)->width(4)->required(); $form->image('pre_packaged_food')->accept('jpg,png,jpeg')->uniqueName()->autoUpload()->retainable()->removable(false)->width(4)->required();
$form->text('area')->width(4)->required()->maxLength(64, '最多输入64个字符'); $form->text('area')->width(4)->required()->maxLength(64, '最多输入64个字符');
$form->text('address')->width(4)->required()->maxLength(128, '最多输入128个字符'); $form->text('address')->width(4)->required()->maxLength(128, '最多输入128个字符');
$form->mobile('mobile')->width(4)->required()->help('药店登录账号')->rules('required|regex:/^1[3456789]\d{9}$/'); $form->mobile('mobile')->width(4)->required()->help('药店登录账号')->rules(function (Form $form) {
// 如果不是编辑状态,则添加字段唯一验证
if (! $id = $form->model()->id) {
return 'unique:App\Models\PharmacyModel,mobile';
}
});
$form->timeRange('business_start', 'business_end', '营业时间')->required(); $form->timeRange('business_start', 'business_end', '营业时间')->required();
$form->map('lat', 'lng', '经纬度坐标'); $form->map('lat', 'lng', '经纬度坐标');
// $form->select('user_id')->options(User::all()->pluck('openid', 'id'))->width(4)->help('实际后台操作可以不用关联'); // $form->select('user_id')->options(User::all()->pluck('openid', 'id'))->width(4)->help('实际后台操作可以不用关联');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment