F
Filament14mo ago
saeed

How use Public Var inside Action

how i can use public var inside a action something like this ->suffixAction( FormAction::make('sendOPT') ->icon('heroicon-m-clipboard') ->label('ارسال کد تایید') ->requiresConfirmation() ->action(function (Set $set, $state) { $this->send_opt = true; }) )
2 Replies
saeed
saeedOP14mo ago
is anyone can help me
awcodes
awcodes14mo ago
Don't think you'll be able to do that with a property. You could use a temporary variable though.
$send_opt = $this->send_opt;

->suffixAction(
FormAction::make('sendOPT')
->icon('heroicon-m-clipboard')
->label('ارسال کد تایید')
->requiresConfirmation()
->action(function (Set $set, $state) use ($send_opt) {
$send_opt = true;
})
)
$send_opt = $this->send_opt;

->suffixAction(
FormAction::make('sendOPT')
->icon('heroicon-m-clipboard')
->label('ارسال کد تایید')
->requiresConfirmation()
->action(function (Set $set, $state) use ($send_opt) {
$send_opt = true;
})
)
depends on what '$this' is at the point of execution
Want results from more Discord servers?
Add your server