feat: add sidebar active-menu helper and users trash view

This commit is contained in:
2026-08-19 13:56:34 +03:30
parent a3d51424fb
commit 407a3e1bec
3 changed files with 187 additions and 0 deletions
+26
View File
@@ -1,6 +1,7 @@
<?php
use App\Models\Tour;
use App\Models\User;
use Carbon\Carbon;
if (!function_exists('generateSortRouteParameter')) {
@@ -57,3 +58,28 @@ if (!function_exists('tourDateRange')) {
return $start->format('Y/m/d') . ' - ' . $end->format('Y/m/d');
}
}
if (!function_exists('activeAdminSidebar')) {
function activeAdminSidebar(string|array $routeNames): string
{
$currentRouteName = Route::currentRouteName();
if (is_string($routeNames)) {
$routeNames = [$routeNames];
}
if (in_array($currentRouteName, $routeNames)) {
return 'active';
}
return '';
}
}
if (!function_exists('getUserFullName')) {
function getUserFullName(?User $user = null): string
{
if (!$user) {
$user = auth()->user();
}
return $user->first_name . ' ' . $user->last_name;
}
}