mirror of
https://gitee.com/wonderful-code/buildadmin
synced 2024-11-21 22:55:36 +00:00
refactor:优化后台基类代码
This commit is contained in:
parent
71d71a58b4
commit
04ef24a4c1
@ -107,7 +107,8 @@ trait Backend
|
||||
*/
|
||||
public function edit(): void
|
||||
{
|
||||
$id = $this->request->param($this->model->getPk());
|
||||
$pk = $this->model->getPk();
|
||||
$id = $this->request->param($pk);
|
||||
$row = $this->model->find($id);
|
||||
if (!$row) {
|
||||
$this->error(__('Record not found'));
|
||||
@ -134,7 +135,6 @@ trait Backend
|
||||
if (class_exists($validate)) {
|
||||
$validate = new $validate;
|
||||
if ($this->modelSceneValidate) $validate->scene('edit');
|
||||
$pk = $this->model->getPk();
|
||||
$data[$pk] = $row[$pk];
|
||||
$validate->check($data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user