Set Action record for later use

Hi. Is it possible to set record in fillForm() method that can I later use in action()?
...
->fillForm(function (Order $order, array $arguments, Action $action): array {
if (array_key_exists('order', $arguments)) {
$order = Order::with(['relations'])->find($arguments['order']['id']);

$action->record($order); // set record
}

# dd($action->getRecord()); // record is set properly
return $this->fillOrder($order->toArray());
})
->form($this->orderForm())
->action(function (array $data, Order $order, Action $action): void {
dd($action->getRecord()); // returns null
...
->fillForm(function (Order $order, array $arguments, Action $action): array {
if (array_key_exists('order', $arguments)) {
$order = Order::with(['relations'])->find($arguments['order']['id']);

$action->record($order); // set record
}

# dd($action->getRecord()); // record is set properly
return $this->fillOrder($order->toArray());
})
->form($this->orderForm())
->action(function (array $data, Order $order, Action $action): void {
dd($action->getRecord()); // returns null
0 Replies
No replies yetBe the first to reply to this messageJoin