StudentKnowledgeGraphPage.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App\Filament\Pages;
  3. use App\Filament\Traits\HasUserRole;
  4. use App\Livewire\StudentKnowledgeGraph;
  5. use BackedEnum;
  6. use UnitEnum;
  7. use Filament\Pages\Page;
  8. use Illuminate\Support\Arr;
  9. class StudentKnowledgeGraphPage extends Page
  10. {
  11. use HasUserRole;
  12. protected static BackedEnum | string | null $navigationIcon = 'heroicon-o-chart-bar';
  13. protected static ?string $navigationLabel = '学生知识图谱';
  14. protected static UnitEnum | string | null $navigationGroup = null;
  15. protected static ?int $navigationSort = 25;
  16. protected static bool $shouldRegisterNavigation = false;
  17. protected string $view = 'filament.pages.student-knowledge-graph-page';
  18. public bool $showNodeDetails = true;
  19. public string $detailLayout = 'inline';
  20. public function mount(): void
  21. {
  22. // 初始化用户角色检查
  23. $this->initializeUserRole();
  24. // Page 类不需要 authorizeResourceAccess
  25. $this->showNodeDetails = filter_var(
  26. request()->query('show_details', true),
  27. FILTER_VALIDATE_BOOLEAN
  28. );
  29. $layout = request()->query('detail_layout', 'inline');
  30. $this->detailLayout = in_array($layout, ['inline', 'drawer'], true)
  31. ? $layout
  32. : 'inline';
  33. }
  34. public function getBreadcrumbs(): array
  35. {
  36. return [
  37. '学生知识图谱',
  38. ];
  39. }
  40. protected function getHeaderWidgets(): array
  41. {
  42. return [
  43. // 可以在这里添加额外的header widgets
  44. ];
  45. }
  46. protected function getFooterWidgets(): array
  47. {
  48. return [
  49. // 可以在这里添加额外的footer widgets
  50. ];
  51. }
  52. }