feat: add sidebar active-menu helper and users trash view
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user