Nakov's avatar

Nakov wrote a reply+100 XP

3mos ago

You can find that in the documentation of the boilerplate that you are using: https://sebastienheyd.github.io/boilerplate/docs/8.x/datatables/column.html#filter

So basically when you are adding the column you can add a custom filter for it:

use Illuminate\Database\Eloquent\Builder;

Column::add('Customer')
        ->data('customer.name')
		->name('customer.name'), // based on https://sebastienheyd.github.io/boilerplate/docs/8.x/datatables/column.html#name

       // or https://sebastienheyd.github.io/boilerplate/docs/8.x/datatables/column.html#filter

->filter(function($query, $q) {
    $query->whereHas('customer', function(Builder $query) use ($q) {
        $query->where('name', '=', $q);
    });
})