更新 app/Admin/Services/BaseService.php
parent
0d81745906
commit
35bd7eea05
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue