addColumn('checkbox', function ($model) { return ''; }); } 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) { $str = ''; if (property_exists($model, 'is_deleted') && $model->is_deleted) { $str .= ''; } elseif ($model->deleted_at && $model->deleted_at !== '0000-00-00') { $str .= ''; } else { $str .= '
'; } $str .= ''; }); } }