EditTeacher.php 1.4 KB

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