Replies: 1 comment 1 reply
-
HI @jererosas If I understood well, you should be able to do something like this: Data source: public function datasource(): Builder
{
return Reservas::query()->with('users'); //skipping conditions for brevity
} Data source fields: public function fields(): PowerGridFields
{
return PowerGrid::fields()
->add('id')
->add('codigo')
->add('user_id')
->add('reservante', fn(Reservas $reserva) => $reserva->user->name)
->add('created_at');
} Columns: public function columns(): array
{
return [
Column::make('Id', 'id'),
Column::make('Codigo Reserva', 'codigo'),
Column::make('Reservante', 'reservante', 'user_id'),
];
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I need to show the user name
Before I did it this way:
<td>$registers->relationship->name</td>
In the documentation it says to do it with "->with('users')"
public function datasource(): Builder
return Reservas::query() ->where('dia_id', Session::get('evento'))->where('tipo', 'online')->with('users');
Now how can I do it with powergrid?
Beta Was this translation helpful? Give feedback.
All reactions