From 7b735b9798b47f0de94645adfee0436464dda96d Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 17 Feb 2016 21:33:15 +0200 Subject: [PATCH] Hide action for main user in datatable --- app/Services/DatatableService.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Services/DatatableService.php b/app/Services/DatatableService.php index 5a1fd279ae..63fe47005b 100644 --- a/app/Services/DatatableService.php +++ b/app/Services/DatatableService.php @@ -41,6 +41,7 @@ class DatatableService private function createDropdown($entityType, $table, $actions) { $table->addColumn('dropdown', function ($model) use ($entityType, $actions) { + $hasAction = false; $str = '
'; if (property_exists($model, 'is_deleted') && $model->is_deleted) { @@ -70,6 +71,7 @@ class DatatableService if ($visible($model)) { $str .= "
  • {$value}
  • "; $lastIsDivider = false; + $hasAction = true; } } elseif ( ! $lastIsDivider) { $str .= "
  • "; @@ -77,6 +79,10 @@ class DatatableService } } + if ( ! $hasAction) { + return ''; + } + if ( ! $lastIsDivider) { $str .= "
  • "; }