@foreach ($actions as $action)
@if ($count_buttons > 3 && $loop->count > 4)
@break
@endif
@if (isset($action['type']) && $action['type'] == 'divider')
@continue
@endif
@if (
empty($action['permission'])
|| (! empty($action['permission']) && user()->can($action['permission']))
)
@php
$type = ! empty($action['type']) ? $action['type'] : 'link';
@endphp
@switch($type)
@case('button')
@break
@case('delete')
@php
$text = $action['text'] ?? null;
$title = $action['title'] ?? null;
$modelId = ! empty($action['model-id']) ? $action['model-id'] : 'id';
$modelName = ! empty($action['model-name']) ? $action['model-name'] : 'name';
@endphp
@break
@default
{{ $action['icon'] }}
@endswitch
@php
array_shift($actions);
$count_buttons++;
@endphp
@endif
@endforeach
@foreach ($actions as $action)
@if (
empty($action['permission'])
|| (! empty($action['permission']) && user()->can($action['permission']))
)
@php $more_actions[] = $action; @endphp
@endif
@endforeach
@if ($more_actions)
@php $divider = false; @endphp
@foreach ($more_actions as $action)
@php
$type = ! empty($action['type']) ? $action['type'] : 'link';
@endphp
@switch($type)
@case('button')
@php $divider = false; @endphp
@break
@case('delete')
@php $divider = false; @endphp
@php
$text = $action['text'] ?? null;
$title = $action['title'] ?? null;
$modelId = ! empty($action['model-id']) ? $action['model-id'] : 'id';
$modelName = ! empty($action['model-name']) ? $action['model-name'] : 'name';
@endphp
@break
@case('divider')
@if (! $divider)
@php $divider = true; @endphp
@endif
@break
@default
@php $divider = false; @endphp
@endswitch
@endforeach
@endif
@endmobile