jamesdordoy / laravel-vue-datatable

Vue.js Datatable made for Laravel
https://jamesdordoy.github.io/laravel-vue-datatable
MIT License
151 stars 52 forks source link

How to preset fake column #122

Closed MIcQo closed 2 years ago

MIcQo commented 3 years ago

Hi,

I have issue to present fake column as a real column.

My model have name attribute which is creates record name by other relationships, i wanna present this value as "name" column in table, how i can do that? it is possible?

Actual situation is: Now Query builder searching column name which don't exists.

protected array $dataTableColumns = [
        'id' => [
            'searchable' => false,
        ],
        'name' => [
            'searchable' => true,
        ],
];
/**
     * @return string
     */
    public function getNameAttribute(): string
    {
        return VehicleService::buildString($this);
    }