EditTeacher.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace App\Filament\Resources\TeacherResource\Pages;
  3. use App\Filament\Resources\TeacherResource;
  4. use Filament\Resources\Pages\EditRecord;
  5. class EditTeacher extends EditRecord
  6. {
  7. protected static string $resource = TeacherResource::class;
  8. protected string $view = 'filament.resources.teacher.pages.edit-teacher';
  9. protected function getRedirectUrl(): string
  10. {
  11. return $this->getResource()::getUrl('view', ['record' => $this->record]);
  12. }
  13. protected function getSavedNotificationTitle(): ?string
  14. {
  15. return '教师信息已更新';
  16. }
  17. protected function getSavedNotification(): ?\Filament\Notifications\Notification
  18. {
  19. return \Filament\Notifications\Notification::make()
  20. ->success()
  21. ->title('教师信息已更新')
  22. ->body('教师信息已成功更新。');
  23. }
  24. public function getTitle(): string
  25. {
  26. return '编辑教师 - ' . $this->record->name;
  27. }
  28. public function getBreadcrumbs(): array
  29. {
  30. return [];
  31. }
  32. protected function getHeaderActions(): array
  33. {
  34. return [];
  35. }
  36. protected function getFormActions(): array
  37. {
  38. return [
  39. $this->getSaveFormAction()
  40. ->label('保存'),
  41. $this->getCancelFormAction()
  42. ->label('取消'),
  43. ];
  44. }
  45. }