Fix Laravel Pint formatting
This commit is contained in:
@@ -6,13 +6,10 @@ use App\Models\NavItem;
|
||||
use App\Models\Role;
|
||||
use App\Models\RoleNavItem;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class NavBuilderService
|
||||
{
|
||||
public function __construct(private NavbarService $navbarService)
|
||||
{
|
||||
}
|
||||
public function __construct(private NavbarService $navbarService) {}
|
||||
|
||||
public function getAdminPayload(): array
|
||||
{
|
||||
@@ -77,7 +74,7 @@ class NavBuilderService
|
||||
$menuParentId = null;
|
||||
}
|
||||
|
||||
if ($menuParentId !== null && !NavItem::query()->whereKey($menuParentId)->exists()) {
|
||||
if ($menuParentId !== null && ! NavItem::query()->whereKey($menuParentId)->exists()) {
|
||||
return ['ok' => false, 'message' => 'Selected parent does not exist.'];
|
||||
}
|
||||
|
||||
@@ -88,7 +85,7 @@ class NavBuilderService
|
||||
'icon_class' => trim((string) ($payload['icon_class'] ?? '')) ?: null,
|
||||
'target' => trim((string) ($payload['target'] ?? '')) ?: null,
|
||||
'sort_order' => (int) ($payload['sort_order'] ?? 0),
|
||||
'is_enabled' => !empty($payload['is_enabled']) ? 1 : 0,
|
||||
'is_enabled' => ! empty($payload['is_enabled']) ? 1 : 0,
|
||||
];
|
||||
|
||||
$roleIds = array_values(array_unique(array_filter(
|
||||
@@ -190,7 +187,7 @@ class NavBuilderService
|
||||
}
|
||||
|
||||
$roleId = (int) ($row['role_id'] ?? 0);
|
||||
$roleName = $row['role_name'] ?? ($roleId ? ('#' . $roleId) : null);
|
||||
$roleName = $row['role_name'] ?? ($roleId ? ('#'.$roleId) : null);
|
||||
|
||||
if ($roleId > 0) {
|
||||
$roleAssignments[$navId]['ids'][] = $roleId;
|
||||
@@ -226,7 +223,7 @@ class NavBuilderService
|
||||
],
|
||||
];
|
||||
|
||||
if (!empty($node['children'])) {
|
||||
if (! empty($node['children'])) {
|
||||
$output = array_merge($output, $this->flattenTreeForResponse($node['children'], $roleAssignments, $depth + 1));
|
||||
}
|
||||
}
|
||||
@@ -239,6 +236,7 @@ class NavBuilderService
|
||||
$s = trim(preg_replace('/\s+/', ' ', $s));
|
||||
$s = preg_replace('/^[^[:alnum:]]+/u', '', $s);
|
||||
$s = preg_replace('/^(?i)(the|an|a)\s+/', '', $s);
|
||||
|
||||
return mb_strtolower($s, 'UTF-8');
|
||||
}
|
||||
|
||||
@@ -250,7 +248,7 @@ class NavBuilderService
|
||||
return $result !== 0 ? $result : ((int) ($a['id'] ?? 0) <=> (int) ($b['id'] ?? 0));
|
||||
});
|
||||
foreach ($nodes as &$node) {
|
||||
if (!empty($node['children'])) {
|
||||
if (! empty($node['children'])) {
|
||||
$this->sortTreeAlpha($node['children']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user