不能删除root 账号

This commit is contained in:
Edward Yang 2022-08-26 11:55:21 +08:00
parent d7deeb62df
commit 4d2e9b3efd
3 changed files with 9 additions and 1 deletions

View File

@ -66,9 +66,13 @@ class CustomerRepo
/**
* @param $id
* @return void
* @throws \Exception
*/
public static function delete($id)
{
if ($id == 1) {
throw new \Exception(trans('admin/customer.cannot_delete_root'));
}
Customer::query()->find($id)->delete();
}

View File

@ -14,5 +14,7 @@ return [
'customers_create' => 'Create',
'customers_show' => 'Detail',
'customers_update' => 'Edit',
'customers_delete' => 'Delete'
'customers_delete' => 'Delete',
'cannot_delete_root' => 'Cannot delete root admin user',
];

View File

@ -15,4 +15,6 @@ return [
'customers_show' => '客户详情',
'customers_update' => '更新客户',
'customers_delete' => '删除客户',
'cannot_delete_root' => '不能删除Root账户',
];