ListTeachers.php 1.1 KB

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