Create Action on relation manager, how to generate a password ?

Hello, do you know in a relation manager how can I define a password and send a mail after the creation.. ? Since it's a static method and I can't store the password as a property of my object.

Tables\Actions\CreateAction::make()->mutateFormDataUsing(function (array $data) {
    $data['type'] = UserTypeEnum::PARTNER;
    $data['password'] = ($this->password = Hash::make(Str::random(15))); // don't work on a static method
    return $data;
})->after(fn () => Mail::to($this->record)->send(
    new UserCredentials($this->record, $this->password)
)),
Was this page helpful?