protonemedia / inertiajs-tables-laravel-query-builder

Inertia.js Tables for Laravel Query Builder
https://protone.media/en/blog/introducing-inertiajs-tables-a-datatables-like-package-for-laravel-query-builder
MIT License
437 stars 131 forks source link

Join other table in the inertiaTable QueryBuilder request #81

Open landryjohn opened 2 years ago

landryjohn commented 2 years ago

I wish to know the proper way to write a querybuilder request for inertia table which can make me use foreign fields in the table. (As weel as fields concatanations).

When i use for instance

$orders = QueryBuilder::for(Order::class) ->defaultSort('created_at') ->allowedIncludes(['user']) ->select('orders.id', 'orders.total_price', DB::raw("concat(users.last_name, ' ', users.first_name) as full_name"), 'orders.paid', 'orders.shipped', 'orders.created_at', 'users.email') ->join('users', 'orders.user_id', '=', 'users.id') -> ...

It works, but i lost all the datatables functionnalities (Filter, Search, Sort, ...)

Thank