51 lines
982 B
PHP
51 lines
982 B
PHP
<?php
|
|
|
|
namespace app\admin\service;
|
|
|
|
use app\admin\validate\VehColorValidate;
|
|
use app\common\traits\crud\CrudServiceTrait;
|
|
use app\common\model\VehColor;
|
|
use support\Request;
|
|
|
|
class VehColorService
|
|
{
|
|
|
|
use CrudServiceTrait;
|
|
|
|
/**
|
|
* 指定当前要操作的模型
|
|
*/
|
|
protected string $modelClass = VehColor::class;
|
|
|
|
/**
|
|
* 验证器
|
|
*/
|
|
protected $validator = VehColorValidate::class;
|
|
|
|
/**
|
|
* 获取验证器
|
|
*/
|
|
public function getValidator()
|
|
{
|
|
return new $this->validator;
|
|
}
|
|
|
|
/**
|
|
* 添加前置处理
|
|
*/
|
|
public function beforeServiceStore($data, Request $request)
|
|
{
|
|
$data['created_by'] = $request->user->uid;
|
|
$data['updated_by'] = $request->user->uid;
|
|
return $data;
|
|
}
|
|
|
|
/**
|
|
* 添加前置处理
|
|
*/
|
|
public function beforeServiceUpdate($data, Request $request)
|
|
{
|
|
$data['updated_by'] = $request->user->uid;
|
|
return $data;
|
|
}
|
|
} |