From 391a57c5667ba00310b928e7db64bbbd821f9109 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Tue, 11 Jun 2024 23:26:46 +0330 Subject: [PATCH] fixed breadcrumb component --- app/Helpers/Helper.php | 72 +++++++++++++++++++ .../views/admin/groups/group-form.blade.php | 2 +- .../components/panel-breadcrumb.blade.php | 29 ++++---- 3 files changed, 88 insertions(+), 15 deletions(-) diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 7059c0d..2123952 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -1,6 +1,7 @@ + + + ' . __(ucfirst($routes[count($routes) - 1])) . ' + + '; + return; + } + $route = $routes[count($routes) - 1]; + if ($route == 'home') { + return; + } + + if ($route == 'all' || $route == 'index' || $route == 'list') { + echo '
  • + + + ' . __(ucfirst($routes[count($routes) - 2])) . ' + +
  • '; + } else { + $link = '#'; + $temp = $routes; + array_pop($temp); + $temp = implode('.', $temp) . '.'; + $link = \route($temp . 'index'); + echo '
  • + + + ' . __(Str::plural(ucfirst($routes[count($routes) - 2]))) . ' + +
  • '; + switch ($route) { + case 'create': + $title = __('Add') . ' ' . __($routes[count($routes) - 2]); + $icon = 'ri-add-line'; + break; + case 'edit': + $title = __('Edit') . ' ' . __($routes[count($routes) - 2]); + $icon = 'ri-edit-line'; + break; + case 'show': + $title = __('Show') . ' ' . __($routes[count($routes) - 2]); + $icon = 'ri-eye-line'; + break; + case 'sort': + $title = __('Sort') . ' ' . __($routes[count($routes) - 2]); + $icon = 'ri-sort-number-asc'; + break; + default: + $title = __('') . ' ' . __(ucfirst($routes[count($routes) - 1])); + $icon = 'ri-bubble-chart-line'; + break; + } + echo '
  • + + + ' . $title . ' + +
  • '; + } +} diff --git a/resources/views/admin/groups/group-form.blade.php b/resources/views/admin/groups/group-form.blade.php index bd34d1f..3019cdf 100644 --- a/resources/views/admin/groups/group-form.blade.php +++ b/resources/views/admin/groups/group-form.blade.php @@ -88,7 +88,7 @@ class="form-control @error('parent') is-invalid @enderror"> @foreach($cats as $cat ) - @if($cat->id != $item->id) + @if( !isset($item) || $cat->id != $item->id )