KTVRemote/app/Livewire/Layout/Navigation.php
allen.yan 42f69e677a 202508281721
加入 己點歌曲
2025-08-28 17:22:49 +08:00

44 lines
1.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Livewire\Layout;
use Livewire\Component;
use App\Livewire\Actions\Logout;
class Navigation extends Component
{
private array $commonMenus = [
['name' => '首頁', 'route' => 'welcome'],
['name' => '新歌快報', 'route' => 'new-songs'],
['name' => '熱門排行', 'route' => 'top-ranking'],
['name' => '歌名查詢', 'route' => 'search-song'],
];
private array $roomMenus = [
['name' => '已點歌曲', 'route' => 'clicked-song'],
['name' => '聲音控制', 'route' => 'sound-control'],
['name' => '真情告白', 'route' => 'love-message'],
];
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);
}
}
public function logout(Logout $logout)
{
$logout();
return redirect('/');
}
public function render()
{
return view('livewire.layout.navigation');
}
}