mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-05 07:20:58 +08:00
fix filament resource notify
This commit is contained in:
@@ -28,9 +28,9 @@ class ListAgentAllows extends PageList
|
||||
$agentAllowRep = new AgentAllowRepository();
|
||||
try {
|
||||
$result = $agentAllowRep->checkClient($data['peer_id'], $data['agent']);
|
||||
$this->notify('success', __('admin.resources.agent_allow.check_pass_msg', ['id' => $result->id]));
|
||||
send_admin_success_notification(__('admin.resources.agent_allow.check_pass_msg', ['id' => $result->id]));
|
||||
} catch (\Exception $exception) {
|
||||
$this->notify('danger', $exception->getMessage());
|
||||
send_admin_fail_notification($exception->getMessage());
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class CreateExam extends CreateRecord
|
||||
$examRep = new ExamRepository();
|
||||
try {
|
||||
$this->record = $examRep->store($data);
|
||||
$this->notify('success', $this->getCreatedNotificationTitle());
|
||||
send_admin_success_notification();
|
||||
if ($another) {
|
||||
// Ensure that the form record is anonymized so that relationships aren't loaded.
|
||||
$this->form->model($this->record::class);
|
||||
@@ -30,7 +30,7 @@ class CreateExam extends CreateRecord
|
||||
$this->redirect($this->getResource()::getUrl('index'));
|
||||
} catch (\Exception $exception) {
|
||||
do_log($exception->getMessage() . "\n" . $exception->getTraceAsString(), "error");
|
||||
$this->notify('danger', $exception->getMessage());
|
||||
send_admin_fail_notification($exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@ class EditExam extends EditRecord
|
||||
$examRep = new ExamRepository();
|
||||
try {
|
||||
$this->record = $examRep->update($data, $this->record->id);
|
||||
$this->notify('success', $this->getSavedNotificationTitle());
|
||||
send_admin_success_notification();
|
||||
$this->redirect($this->getResource()::getUrl('index'));
|
||||
} catch (\Exception $exception) {
|
||||
$this->notify('danger', $exception->getMessage());
|
||||
send_admin_fail_notification($exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ class EditSeedBoxRecord extends EditRecord
|
||||
$rep = new SeedBoxRepository();
|
||||
try {
|
||||
$this->record = $rep->update($data, $this->record->id);
|
||||
$this->notify('success', $this->getSavedNotificationTitle());
|
||||
send_admin_success_notification();
|
||||
$this->redirect($this->getResource()::getUrl('index'));
|
||||
} catch (\Exception $exception) {
|
||||
$this->notify('danger', $exception->getMessage());
|
||||
send_admin_fail_notification($exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,12 +26,12 @@ class ListSeedBoxRecords extends PageList
|
||||
->action(function ($data) {
|
||||
try {
|
||||
isIPSeedBox($data['ip'], $data['uid'], true, true);
|
||||
$this->notify('success', nexus_trans("seed-box.is_seed_box_no"));
|
||||
send_admin_success_notification(nexus_trans("seed-box.is_seed_box_no"));
|
||||
} catch (SeedBoxYesException $exception) {
|
||||
$this->notify('danger', nexus_trans("seed-box.is_seed_box_yes", ['id' => $exception->getId()]));
|
||||
send_admin_fail_notification(nexus_trans("seed-box.is_seed_box_yes", ['id' => $exception->getId()]));
|
||||
} catch (\Throwable $throwable) {
|
||||
do_log($throwable->getMessage() . $throwable->getTraceAsString(), "error");
|
||||
$this->notify('danger', $throwable->getMessage());
|
||||
send_admin_fail_notification($throwable->getMessage());
|
||||
}
|
||||
})
|
||||
];
|
||||
|
||||
@@ -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')),
|
||||
|
||||
@@ -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'))
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user