From c430c39f1c111271dc0a5351c62149cca429ee44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Wed, 14 Jun 2023 18:11:00 +0300 Subject: [PATCH] fixed list page table mobile-action permission issue.. --- .../components/table/actions-mobile.blade.php | 96 +++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/resources/views/components/table/actions-mobile.blade.php b/resources/views/components/table/actions-mobile.blade.php index 71ffcd2e6..66be3934f 100644 --- a/resources/views/components/table/actions-mobile.blade.php +++ b/resources/views/components/table/actions-mobile.blade.php @@ -19,70 +19,70 @@
@foreach ($actions as $action) - @if (! empty($action['permission'])) - @can($action['permission']) - @endif - @if ($count_buttons > 3 && $loop->count > 4) @break @endif - @php - $type = ! empty($action['type']) ? $action['type'] : 'link'; - @endphp + @if (isset($action['type']) && $action['type'] == 'divider') + @continue + @endif - @switch($type) - @case('button') - - @break + @switch($type) + @case('button') + + @break - - @break + @case('delete') + @php + $title = $action['title'] ?? null; + $modelId = ! empty($action['model-id']) ? $action['model-id'] : 'id'; + $modelName = ! empty($action['model-name']) ? $action['model-name'] : 'name'; + @endphp - @default - -
- - {{ $action['icon'] }} - + + @break - {{ $action['title'] }} -
-
- @endswitch + @default + +
+ + {{ $action['icon'] }} + - @php - array_shift($actions); + {{ $action['title'] }} +
+
+ @endswitch - $count_buttons++; - @endphp + @php + array_shift($actions); - @if (! empty($action['permission'])) - @endcan + $count_buttons++; + @endphp @endif @endforeach @foreach ($actions as $action) - @if (! empty($action['permission'])) - @can($action['permission']) - @php $more_actions[] = $action; @endphp - @endcan - @else + @if ( + empty($action['permission']) + || (! empty($action['permission']) && user()->can($action['permission'])) + ) @php $more_actions[] = $action; @endphp @endif @endforeach @@ -147,4 +147,4 @@ @endif
- \ No newline at end of file +