KTVRemote/app/Livewire/Layout/Navigation.php
allen.yan f070df7d03 202508271602
加入包廂代碼
2025-08-27 16:03:45 +08:00

46 lines
1.2 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' => 'social-media'],
['name' => '真情告白', 'route' => 'love-message'],
['name' => '心情貼圖', 'route' => 'mood-stickers'],
];
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');
}
}