How do I add a column to an existing resource list?
You can use the addColumn() method(s) to add a column to an existing resource list:
\Aero\Admin\ResourceLists\OrdersResourceList::extend(function (\Aero\Admin\ResourceLists\OrdersResourceList $list, \Closure $next) {
// Add it as the first column
$list->addColumn('Header', function($row) {
return 'Content';
});
// Add it after a specific column
$list->addColumnAfter('Header', function($row) {
return $row->reference;
}, 'customer');
// Add it before a specific column
$list->addColumnBefore('Header', function($row) {
return $row->reference;
}, 'customer');
return $next($list);
});
If you need to see the keys of the existing columns in order to position your new column appropriately, you can dump them out:
\Aero\Admin\ResourceLists\OrdersResourceList::extend(function (\Aero\Admin\ResourceLists\OrdersResourceList $list, \Closure $next) {
dd($list->getColumns()->map->key());
return $next($list);
});