We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the below method I want to return joined tables data. is there any documentation to refere please
public function query(User $model): QueryBuilder { return $model->newQuery(); }
The example of the joint
$users = DB::table('users') ->join('businesses', 'users.business_id', '=', 'businesses.id') ->select('users.id','users.name', 'users.email', 'businesses.company_name as business') ->get(); return $users->newQuery();
The text was updated successfully, but these errors were encountered:
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'); }
Sorry, something went wrong.
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') ]; }
`
No branches or pull requests
In the below method I want to return joined tables data. is there any documentation to refere please
The example of the joint
The text was updated successfully, but these errors were encountered: