/** * Creates a list column object from it's name and configuration. */ protected function makeListColumn($name, $config) { if (is_string($config)) { $label = $config; } elseif (isset($config['label'])) { $label = $config['label']; } else { $label = studly_case($name); } if (strpos($name, '[') !== false && strpos($name, ']') !== false) { $config['valueFrom'] = $name; $config['sortable'] = false; $config['searchable'] = false; } $columnType = isset($config['type']) ? $config['type'] : null; $column = new ListColumn($name, $label); $column->displayAs($columnType, $config); return $column; }
/** * Creates a list column object from it's name and configuration. */ protected function makeListColumn($name, $config) { if (is_string($config)) { $label = $config; } elseif (isset($config['label'])) { $label = $config['label']; } else { $label = studly_case($name); } if (starts_with($name, 'pivot[') && strpos($name, ']') !== false) { $_name = HtmlHelper::nameToArray($name); $config['relation'] = array_shift($_name); $config['valueFrom'] = array_shift($_name); $config['searchable'] = false; } elseif (strpos($name, '[') !== false && strpos($name, ']') !== false) { $config['valueFrom'] = $name; $config['sortable'] = false; $config['searchable'] = false; } $columnType = isset($config['type']) ? $config['type'] : null; $column = new ListColumn($name, $label); $column->displayAs($columnType, $config); return $column; }
/** * Creates a list column object from it's name and configuration. */ protected function makeListColumn($name, $config) { if (is_string($config)) { $label = $config; } elseif (isset($config['label'])) { $label = $config['label']; } else { $label = studly_case($name); } $columnType = isset($config['type']) ? $config['type'] : null; $column = new ListColumn($name, $label); $column->displayAs($columnType, $config); return $column; }