From 35bd7eea05ac01431b4fc214e6623d06403d2168 Mon Sep 17 00:00:00 2001 From: panliang <1163816051@qq.com> Date: Fri, 1 Dec 2023 10:43:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/Admin/Services/BaseSer?= =?UTF-8?q?vice.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Services/BaseService.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Admin/Services/BaseService.php b/app/Admin/Services/BaseService.php index 14b11eb..bac6f16 100644 --- a/app/Admin/Services/BaseService.php +++ b/app/Admin/Services/BaseService.php @@ -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; }