fix filament resource notify

This commit is contained in:
xiaomlove
2025-02-08 01:24:29 +08:00
parent 4a0475b49c
commit e45b7c42f0
9 changed files with 20 additions and 26 deletions

View File

@@ -81,10 +81,10 @@ class ViewExamUser extends ViewRecord
$examRep = new ExamRepository();
try {
$examRep->avoidExamUser($this->record->id);
$this->notify('success', 'Success !');
send_admin_success_notification();
$this->record = $this->resolveRecord($this->record->id);
} catch (\Exception $exception) {
$this->notify('danger', $exception->getMessage());
send_admin_fail_notification($exception->getMessage());
}
})
->label(__('admin.resources.exam_user.action_avoid')),
@@ -106,10 +106,10 @@ class ViewExamUser extends ViewRecord
$examRep = new ExamRepository();
try {
$examRep->updateExamUserEnd($this->record, Carbon::parse($data['end']), $data['reason'] ?? "");
$this->notify('success', 'Success !');
send_admin_success_notification();
$this->record = $this->resolveRecord($this->record->id);
} catch (\Exception $exception) {
$this->notify('danger', $exception->getMessage());
send_admin_fail_notification($exception->getMessage());
}
})
->label(__('admin.resources.exam_user.action_update_end')),

View File

@@ -88,10 +88,10 @@ class ViewHitAndRun extends ViewRecord
$hitAndRunRep = new HitAndRunRepository();
try {
$hitAndRunRep->pardon($this->record->id, Auth::user());
$this->notify('success', 'Success !');
send_admin_success_notification();
$this->record = $this->resolveRecord($this->record->id);
} catch (\Exception $exception) {
$this->notify('danger', $exception->getMessage());
send_admin_fail_notification($exception->getMessage());
}
})
->label(__('admin.resources.hit_and_run.action_pardon'))

View File

@@ -18,16 +18,10 @@ class CreateUser extends CreateRecord
$data = $this->form->getState();
try {
$this->record = $userRep->store($data);
$this->notify(
'success ',
$this->getCreatedNotificationTitle(),
);
send_admin_success_notification();
$this->redirect($this->getRedirectUrl());
} catch (\Exception $exception) {
$this->notify(
'danger',
$exception->getMessage(),
);
send_admin_fail_notification($exception->getMessage());
}
}
}

View File

@@ -250,7 +250,7 @@ class UserProfile extends ViewRecord
->requiresConfirmation()
->action(function () {
if (Auth::user()->class <= $this->record->class) {
$this->notify('danger', 'No permission!');
send_admin_fail_notification("No permission!");
return;
}
$this->record->status = User::STATUS_CONFIRMED;