Add title and menu to Page component
This commit is contained in:
		
							parent
							
								
									2012aa636f
								
							
						
					
					
						commit
						09acf0c98c
					
				|  | @ -7,9 +7,10 @@ use Illuminate\View\Component; | ||||||
| class Layout extends Component | class Layout extends Component | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
|     public function __construct(public string $pageClass = '', public string $title = '') |     public function __construct(public string $pageClass = '', public string $title = '', public string $menu = '') | ||||||
|     { |     { | ||||||
|         session()->put('title', $title); |         session()->put('title', $title); | ||||||
|  |         session()->put('menu', $menu); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function userName(): string |     public function userName(): string | ||||||
|  |  | ||||||
|  | @ -18,13 +18,12 @@ class SettingLayout extends Component | ||||||
|                 'is_active' => get_class($setting) === $active, |                 'is_active' => get_class($setting) === $active, | ||||||
|                 'title' => $setting->title(), |                 'title' => $setting->title(), | ||||||
|             ])->toArray(); |             ])->toArray(); | ||||||
|         session()->put('menu', 'setting'); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function render() |     public function render() | ||||||
|     { |     { | ||||||
|         return <<<'HTML' |         return <<<'HTML' | ||||||
|             <x-page::layout :title="$active::title()"> |             <x-page::layout :title="$active::title()" menu="setting"> | ||||||
|                 <x-slot:right> |                 <x-slot:right> | ||||||
|                     {{ $right ?? '' }} |                     {{ $right ?? '' }} | ||||||
|                 </x-slot:right> |                 </x-slot:right> | ||||||
|  |  | ||||||
|  | @ -12,16 +12,13 @@ class DashboardComponent extends Component | ||||||
| 
 | 
 | ||||||
|     public function mount(DashboardFactory $factory): void |     public function mount(DashboardFactory $factory): void | ||||||
|     { |     { | ||||||
|         session()->put('menu', 'dashboard'); |  | ||||||
|         session()->put('title', 'Dashboard'); |  | ||||||
| 
 |  | ||||||
|         $this->blocks = $factory->load(); |         $this->blocks = $factory->load(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function render(): string |     public function render(): string | ||||||
|     { |     { | ||||||
|         return <<<'HTML' |         return <<<'HTML' | ||||||
|             <x-page::layout> |             <x-page::layout title="Dashboard" menu="dashboard"> | ||||||
|                 <div class="gap-6 md:grid-cols-2 xl:grid-cols-4 grid p-6"> |                 <div class="gap-6 md:grid-cols-2 xl:grid-cols-4 grid p-6"> | ||||||
|                     @foreach($this->blocks as $block) |                     @foreach($this->blocks as $block) | ||||||
|                         <x-ui::box title="{{$block->title()}}" :second="true"> |                         <x-ui::box title="{{$block->title()}}" :second="true"> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue