addColumn('checkbox', function ($model) { $can_edit = Auth::user()->hasPermission('edit_all') || (isset($model->user_id) && Auth::user()->id == $model->user_id); return !$can_edit?'':''; }); } foreach ($columns as $column) { // set visible to true by default if (count($column) == 2) { $column[] = true; } list($field, $value, $visible) = $column; if ($visible) { $table->addColumn($field, $value); $orderColumns[] = $field; } } if ($actions) { $this->createDropdown($entityType, $table, $actions); } return $table->orderColumns($orderColumns)->make(); } private function createDropdown($entityType, $table, $actions) { $table->addColumn('dropdown', function ($model) use ($entityType, $actions) { $hasAction = false; $str = '