Skip to content

Commit

Permalink
feat: 优化 update 方法主键获取逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
slowlyo committed Jun 22, 2024
1 parent 8b23c55 commit 568a25e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ public function edit($id)
*/
public function update(Request $request)
{
$result = $this->service->update($this->getPrimaryValue($request), $request->all());
$primaryKey = $this->getPrimaryValue($request) ?: data_get(func_get_args(), 1);
$result = $this->service->update($primaryKey, $request->all());

return $this->autoResponse($result, admin_trans('admin.save'));
}
Expand Down

0 comments on commit 568a25e

Please sign in to comment.