I tried to append several values in the same column of Laravel AJAX datatable. Here is what I typed in the controller :
$table->addColumn('academic_options', function ($row) {
return ($row->academic_section ? $row->academic_section->code : '') . ', ' . ($row->option_1 ? $row->option_1->code : '') .
', ' . ($row->option_2 ? $row->option_2->code : '') . ', ' . ($row->option_3 ? $row->option_3->code : '') . ', ' . ($row->option_9 ? $row->option_9->code : '');
});
And this is what is shown screenshot
How should I do it so the values will be separated properly, if possible how can i create a list of existed values, the empty value would be hidden.