logistics/app/adminapi/validate/vehicle/VehicleValidate.php

91 lines
2.4 KiB
PHP
Raw Normal View History

2023-08-17 11:30:23 +08:00
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate\vehicle;
use app\common\validate\BaseValidate;
/**
* Vehicle验证器
* Class VehicleValidate
* @package app\adminapi\validate
*/
class VehicleValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'license' => 'require|unique:vehicle',
2023-09-07 13:38:34 +08:00
'pic' => 'require',
2023-08-28 15:00:49 +08:00
'gps_imei' => 'require|number|unique:vehicle',
2023-08-30 22:36:10 +08:00
'type' => 'require|in:0,1',
'status' => 'require|in:0,1,2',
2023-08-17 11:30:23 +08:00
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'license' => '车辆牌照',
2023-09-07 13:38:34 +08:00
'pic' => '车辆图片',
2023-08-17 11:30:23 +08:00
'gps_imei' => 'gps定位器设备标志',
2023-08-30 22:36:10 +08:00
'type' => '车辆类型0平台自营 1社会车辆',
'status' => '车辆状态0未出租 1签约中 2已出租',
2023-08-17 11:30:23 +08:00
];
/**
* @notes 添加场景
* @return VehicleValidate
* @author likeadmin
* @date 2023/08/17 09:23
*/
public function sceneAdd()
{
2023-09-07 13:38:34 +08:00
return $this->only(['license','pic','gps_imei']);
2023-08-17 11:30:23 +08:00
}
/**
* @notes 编辑场景
* @return VehicleValidate
* @author likeadmin
* @date 2023/08/17 09:23
*/
public function sceneEdit()
{
2023-09-07 13:38:34 +08:00
return $this->only(['id','license','pic','gps_imei','status','type'])->remove('license', 'unique')->remove('gps_imei', 'unique');
2023-08-17 11:30:23 +08:00
}
/**
* @notes 详情场景
* @return VehicleValidate
* @author likeadmin
* @date 2023/08/17 09:23
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}