How to get Field component data/config in Form Action

Can we get the field component data or the configurations in the mounted form action?

Forms\Components\FileUpload::make('image')
  ->disk('public')
  ->directory('posts/featured-images')
  ->hintAction(
    Action::make('custom_action')
      ->action(function () {
        // get the disk and directory from the field
      })
  ),
Solution
Upload image from URL

Just learned form Ralph that we can use $component variable to get the Field itself on which the action is mounted.


->action(function (FileUpload $component)
Was this page helpful?