Open alukardua1 opened 1 year ago
I just needed the same thing, it's late but I'll leave it in case it helps someone
"normal" column function:
public function columns()
{
return [
Column::name('id')
->label('id'),
Column::name('name')
->label('name'),
Column::name('age')
->label('age'),
];
}
returning age if user is admin:
public function builder()
{
$this->admin = TRUE;
}
public function columns()
{
$cols = [
Column::name('id')
->label('id'),
Column::name('name')
->label('name'),
];
if($this->admin == TRUE){
$cols[] =
Column::name('age')
->label('age');
}
return $cols;
}
The setting of $this->admin should be done according to the logic you want to use.
Is it possible to add a function to remove a column from the output in the table. I have user groups and I would like to customize the output of certain columns for different user groups?