fixed breadcrumb component

pull/44/head
A1Gard 7 months ago
parent 970dfd0795
commit 391a57c566

@ -1,6 +1,7 @@
<?php
use App\Helpers;
use Illuminate\Support\Facades\Route;
/**
@ -257,3 +258,74 @@ function sluger($name, $replace_char = '-')
return substr($name, 0, 120);
}
/**
* generate last item of breadcrumb of admin panel
* @return void
*/
function lastCrump()
{
$routes = explode('.', Route::currentRouteName());
if (count($routes) != 3) {
echo '<li >
<a>
<i class="fa fa-cube" ></i>
' . __(ucfirst($routes[count($routes) - 1])) . '
</a>
</li>';
return;
}
$route = $routes[count($routes) - 1];
if ($route == 'home') {
return;
}
if ($route == 'all' || $route == 'index' || $route == 'list') {
echo '<li >
<a>
<i class="fa fa-list" ></i>
' . __(ucfirst($routes[count($routes) - 2])) . '
</a>
</li>';
} else {
$link = '#';
$temp = $routes;
array_pop($temp);
$temp = implode('.', $temp) . '.';
$link = \route($temp . 'index');
echo '<li>
<a href="' . $link . '">
<i class="ri-list-check" ></i>
' . __(Str::plural(ucfirst($routes[count($routes) - 2]))) . '
</a>
</li>';
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 '<li>
<a>
<i class="' . $icon . '" ></i>
' . $title . '
</a>
</li>';
}
}

@ -88,7 +88,7 @@
class="form-control @error('parent') is-invalid @enderror">
<option value=""> {{__('No parent')}} </option>
@foreach($cats as $cat )
@if($cat->id != $item->id)
@if( !isset($item) || $cat->id != $item->id )
<option value="{{ $cat->id }}"
@if (old('parent',$item->parent_id??null) == $cat->id ) selected @endif >
{{$cat->name}}

@ -1,28 +1,29 @@
<nav id="panel-breadcrumb">
<ul>
<li>
<a href="#1">
<a href="{{url('/')}}" target="_blank">
<i class="ri-home-3-line"></i>
{{config('app.name')}}
</a>
</li>
<li>
<a href="#2">
<a href="{{route('admin.dash')}}">
<i class="ri-dashboard-3-line"></i>
{{__("Dashboard")}}
</a>
</li>
<li>
<a href="#3">
<i class="ri-user-3-line"></i>
{{__("Users")}}
</a>
</li>
<li>
<span>
<i class="ri-add-line"></i>
{{__("Add new user")}}
</span>
</li>
{{lastCrump()}}
{{-- <li>--}}
{{-- <a href="#3">--}}
{{-- <i class="ri-user-3-line"></i>--}}
{{-- {{__("Users")}}--}}
{{-- </a>--}}
{{-- </li>--}}
{{-- <li>--}}
{{-- <span>--}}
{{-- <i class="ri-add-line"></i>--}}
{{-- {{__("Add new user")}}--}}
{{-- </span>--}}
{{-- </li>--}}
</ul>
</nav>

Loading…
Cancel
Save