1
0
Fork 0

更新 app/Admin/Services/BaseService.php

panliang 2023-12-01 10:43:12 +08:00
parent 0d81745906
commit 35bd7eea05
1 changed files with 4 additions and 3 deletions

View File

@ -2,6 +2,7 @@
namespace App\Admin\Services;
use Illuminate\Database\Eloquent\Model;
use Slowlyo\OwlAdmin\Services\AdminService;
/**
@ -80,7 +81,7 @@ class BaseService extends AdminService
{
$data = $this->resloveData($data);
$model = $this->query()->whereKey($primaryKey)->firstOrFail();
$validate = $this->validate($data, $model->id);
$validate = $this->validate($data, $model);
if ($validate !== true) {
$this->setError($validate);
return false;
@ -115,10 +116,10 @@ class BaseService extends AdminService
* 表单验证
*
* @param array $data
* @param int $id : 添加, 非空: 修改
* @param Model $model : 添加, 非空: 修改
* @return mixed true: 验证通过, string: 错误提示
*/
public function validate($data, $id = null)
public function validate($data, $model = null)
{
return true;
}