KTVRemote/app/Livewire/Layout/Navigation.php

44 lines
1.1 KiB
PHP
Raw Normal View History

2025-08-26 11:25:53 +08:00
<?php
namespace App\Livewire\Layout;
use Livewire\Component;
use App\Livewire\Actions\Logout;
class Navigation extends Component
{
2025-08-27 16:03:45 +08:00
private array $commonMenus = [
2025-08-26 11:25:53 +08:00
['name' => '首頁', 'route' => 'welcome'],
['name' => '新歌快報', 'route' => 'new-songs'],
['name' => '熱門排行', 'route' => 'top-ranking'],
['name' => '歌名查詢', 'route' => 'search-song'],
2025-08-27 16:03:45 +08:00
];
private array $roomMenus = [
2025-08-26 11:25:53 +08:00
['name' => '已點歌曲', 'route' => 'clicked-song'],
['name' => '聲音控制', 'route' => 'sound-control'],
['name' => '真情告白', 'route' => 'love-message'],
];
2025-08-27 16:03:45 +08:00
public array $menus = [];
public function mount()
{
// 先放共用的
$this->menus = $this->commonMenus;
// 如果有 room_code再合併
if (session()->has('room_code')) {
$this->menus = array_merge($this->menus, $this->roomMenus);
}
}
2025-08-26 11:25:53 +08:00
public function logout(Logout $logout)
{
$logout();
return redirect('/');
}
public function render()
{
return view('livewire.layout.navigation');
}
}