diff --git a/app/Models/Common/Company.php b/app/Models/Common/Company.php
index 754c498a1f3..5756ac02c57 100644
--- a/app/Models/Common/Company.php
+++ b/app/Models/Common/Company.php
@@ -548,7 +548,7 @@ public function getLineActionsAttribute()
'title' => trans('general.switch'),
'icon' => 'settings_ethernet',
'url' => route('companies.switch', $this->id),
- 'permission' => 'read-common-companies',
+ //'permission' => 'read-common-companies', remove this permission to allow switching to any company
'attributes' => [
'id' => 'index-line-actions-switch-company-' . $this->id,
],
diff --git a/resources/views/components/table/actions.blade.php b/resources/views/components/table/actions.blade.php
index d9fbd4750cc..be8853aa8d3 100644
--- a/resources/views/components/table/actions.blade.php
+++ b/resources/views/components/table/actions.blade.php
@@ -8,73 +8,70 @@
@else
@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
-
- @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'] }}
-
-
-
-
{{ $action['title'] }}
-
-
-
- @endswitch
-
- @php
- array_shift($actions);
-
- $count_buttons++;
- @endphp
-
- @if (! empty($action['permission']))
- @endcan
+ @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'] }}
+
+
+
+
{{ $action['title'] }}
+
+
+
+ @endswitch
+
+ @php
+ array_shift($actions);
+
+ $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