@php $relation = Str::before($column_name, '_id'); $field = 'id'; @endphp { render: function ( data, type, row, meta ) { if(!row.{{$relation}}) return null; return row.{{$relation}}.{{$field}}; }, data: '{{$relation}}[,{{$field}}]', name: '{{$relation}}.{{$field}}', className: 'align-middle' },