ListTeachers.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Filament\Resources\TeacherResource\Pages;
  3. use App\Filament\Resources\TeacherResource;
  4. use Filament\Actions;
  5. use Filament\Resources\Pages\ListRecords;
  6. class ListTeachers extends ListRecords
  7. {
  8. protected static string $resource = TeacherResource::class;
  9. protected function getHeaderActions(): array
  10. {
  11. return [
  12. Actions\CreateAction::make()
  13. ->label('创建老师')
  14. ->icon('heroicon-o-plus')
  15. ->size('lg')
  16. ->color('primary'),
  17. ];
  18. }
  19. public function getTitle(): string
  20. {
  21. return '教师管理';
  22. }
  23. public function getBreadcrumbs(): array
  24. {
  25. return [
  26. static::getResource()::getUrl('index') => '教师管理',
  27. ];
  28. }
  29. protected function getHeaderWidgets(): array
  30. {
  31. return [];
  32. }
  33. public function getHeading(): string
  34. {
  35. return '教师管理';
  36. }
  37. public function getSubheading(): string
  38. {
  39. $count = \App\Models\Teacher::count();
  40. return "共 {$count} 位教师";
  41. }
  42. }