Open bashiirmahad opened 1 year ago
Sorry, no documentation atm but I will be working on a new demo site soon.
Anyways, join should be the same with how the query builder works:
public function query(User $model): QueryBuilder
{
return $model->newQuery()
->join('businesses', 'users.business_id', '=', 'businesses.id')
->select('users.id', 'users.name', 'users.email', 'businesses.company_name as business');
}
I Have a eloquent solution hope useful
UserDatatable.php `
...
public function dataTable(QueryBuilder $query): EloquentDataTable
{
return (new EloquentDataTable($query))
//Relationship Code
->addColumn('UserName', function (User $user) {
return $user->UserDetail->UserName;
});
}
....
/**
* Get the dataTable columns definition.
*/
public function getColumns(): array
{
return [
Column::make('id'),
Column::make('UserName')->title('Name')
];
}
`
In the below method I want to return joined tables data. is there any documentation to refere please
The example of the joint