StudentKnowledgeGraphPage.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 = '资源';
  15. protected static ?int $navigationSort = 25;
  16. protected string $view = 'filament.pages.student-knowledge-graph-page';
  17. public bool $showNodeDetails = true;
  18. public string $detailLayout = 'inline';
  19. public function mount(): void
  20. {
  21. // 初始化用户角色检查
  22. $this->initializeUserRole();
  23. // Page 类不需要 authorizeResourceAccess
  24. $this->showNodeDetails = filter_var(
  25. request()->query('show_details', true),
  26. FILTER_VALIDATE_BOOLEAN
  27. );
  28. $layout = request()->query('detail_layout', 'inline');
  29. $this->detailLayout = in_array($layout, ['inline', 'drawer'], true)
  30. ? $layout
  31. : 'inline';
  32. }
  33. public function getBreadcrumbs(): array
  34. {
  35. return [
  36. '学生知识图谱',
  37. ];
  38. }
  39. protected function getHeaderWidgets(): array
  40. {
  41. return [
  42. // 可以在这里添加额外的header widgets
  43. ];
  44. }
  45. protected function getFooterWidgets(): array
  46. {
  47. return [
  48. // 可以在这里添加额外的footer widgets
  49. ];
  50. }
  51. }