protonemedia/laravel-splade

FormBuilder: no way to pass additional data?

stuartcusackie opened this issue · 1 comments

Laravel Version: 10.13.5
PHP Version: 8.1.12
Splade JS Version (npm): 1.4.14
Splade PHP Version (composer): 1.4.14
Dev environment: Windows Laragon
Using Splade JetStream

Description:

I'm trying to set my form builder class action to a route that requires a model, i.e. $user.

public function configure(SpladeForm $form)
{
  $form
    ->action(route('users.edit', $user))
    ->method('POST');
}

But of course $user is not defined, and I don't see a way to get it to the Form Builder Class, there are no useful public methods on the AbstractForm class.

Nevermind! I found the way:

$form = EditUserForm::make();
$form->action(route('users.edit', $user));