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; }