How to pass row data (or the model) to the Details view? #609
Answered
by
dansysanalyst
eswachsman
asked this question in
Q&A
-
I am trying to use the Details on my rows, but I cannot find information in the documentation how to pass the row (or model) information to the details view. I am able to pass the options array, but how to I pass along row data to the view? |
Beta Was this translation helpful? Give feedback.
Answered by
dansysanalyst
Sep 4, 2022
Replies: 1 comment 1 reply
-
HI @eswachsman, Thank you for your question. You can access your model data with the <?php
use PowerComponents\LivewirePowerGrid\Detail;
public function setUp(): array
{
$this->showCheckBox();
return [
//...
Detail::make()
->view('components.detail')
->options(['message' => 'hello world'])
->showCollapseIcon(),
];
} And I've created a view with: <!-- File: resources/views/components/detail.blade.php -->
<div>
<p>
Dish has {{ $row->calories }} ({{ $options['message'] }})
</p>
</div> Resulting in: This example was added to PowerGrid-Demo repository and opened a PR to improve the documentation as it is not clear at the moment. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
eswachsman
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
HI @eswachsman,
Thank you for your question. You can access your model data with the
$row
variable.And I've created a view with:
Resulting in:
This example was added to PowerGrid-Demo repository and …