mirror of
https://github.com/dyzulk/trustlab-api.git
synced 2026-01-26 05:15:35 +07:00
115 lines
3.7 KiB
PHP
115 lines
3.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
class NavigationController extends Controller
|
|
{
|
|
public function index(Request $request)
|
|
{
|
|
$user = $request->user();
|
|
$menuGroups = [];
|
|
|
|
// 1. Admin Management (Admin or Owner)
|
|
if ($user && $user->isAdminOrOwner()) {
|
|
$menuGroups[] = [
|
|
'title' => 'Admin Management',
|
|
'items' => [
|
|
[
|
|
'name' => 'User Management',
|
|
'icon' => 'users',
|
|
'route' => '/dashboard/admin/users',
|
|
],
|
|
[
|
|
'name' => 'Root CA Management',
|
|
'icon' => 'certificate',
|
|
'route' => '/dashboard/admin/root-ca',
|
|
],
|
|
[
|
|
'name' => 'Ticket Management',
|
|
'icon' => 'support-ticket',
|
|
'route' => '/dashboard/admin/tickets',
|
|
],
|
|
[
|
|
'name' => 'Legal Page Management',
|
|
'icon' => 'pages',
|
|
'route' => '/dashboard/admin/legal',
|
|
],
|
|
[
|
|
'name' => 'Inquiries',
|
|
'icon' => 'inbox',
|
|
'route' => '/dashboard/admin/inquiries',
|
|
],
|
|
[
|
|
'name' => 'SMTP Tester',
|
|
'icon' => 'smtp',
|
|
'route' => '/dashboard/admin/smtp-tester',
|
|
],
|
|
]
|
|
];
|
|
}
|
|
|
|
// 2. Main Menu (Common)
|
|
$mainItems = [
|
|
[
|
|
'name' => 'Dashboard',
|
|
'icon' => 'dashboard',
|
|
'route' => '/dashboard',
|
|
],
|
|
[
|
|
'name' => 'Certificates',
|
|
'icon' => 'certificate',
|
|
'route' => '/dashboard/certificates',
|
|
],
|
|
[
|
|
'name' => 'API Keys',
|
|
'icon' => 'api-key',
|
|
'route' => '/dashboard/api-keys',
|
|
],
|
|
[
|
|
'name' => 'Support Tickets',
|
|
'icon' => 'support-ticket',
|
|
'route' => '/dashboard/support', // Assuming support.index maps to /support
|
|
],
|
|
];
|
|
|
|
// "My Services" for Customers ONLY
|
|
if ($user && $user->role === \App\Models\User::ROLE_CUSTOMER) {
|
|
// We can insert "My Services" if we want to keep that feature for customers
|
|
// As per user request "ikuiti app-beta", but we also added "My Services" previously.
|
|
// Let's keep "My Services" as it's a nice dedicated page for them, inserting it after Dashboard.
|
|
array_splice($mainItems, 1, 0, [[
|
|
'name' => 'My Services',
|
|
'icon' => 'layers',
|
|
'route' => '/dashboard/services',
|
|
]]);
|
|
}
|
|
|
|
$menuGroups[] = [
|
|
'title' => 'Menu',
|
|
'items' => $mainItems,
|
|
];
|
|
|
|
// 3. My Account (Common)
|
|
$menuGroups[] = [
|
|
'title' => 'My Account',
|
|
'items' => [
|
|
[
|
|
'name' => 'User Profile',
|
|
'icon' => 'user-profile',
|
|
'route' => '/dashboard/profile',
|
|
],
|
|
[
|
|
'name' => 'Account Settings',
|
|
'icon' => 'settings',
|
|
'route' => '/dashboard/settings',
|
|
],
|
|
]
|
|
];
|
|
|
|
return response()->json($menuGroups);
|
|
}
|
|
|
|
}
|