F
Filament12mo ago
erigra.

Access current record within Widget

Hey, I have a resource like ProductResource and I have an EditProduct page. Within EditProduct I have a Widget like ProductWidget. When on the edit page of that product like /product/1, how can I access the current record (1) from the Widget model? Can't seem to find anything about it in the docs. Thank you.
Solution:
Try to declare public ?Model $record = null; in the widget class, you will have access to the EditProduct record
Jump to solution
2 Replies
Solution
David Vincent
David Vincent12mo ago
Try to declare public ?Model $record = null; in the widget class, you will have access to the EditProduct record
erigra.
erigra.OP12mo ago
Thanks @David Vincent, works like a charm

Did you find this page helpful?