How use ->action() and ->url
I trying use the form and send the form data through the ->url(), if i use ->url() without opening the form it is redirecting to the url.
Action::make('Print Label')
->action(function ($record, array $data) {
//
})
->url(
fn (Despatch $record, array $data): string => route('web.despatchprintlable', ['record' => $record, 'space' => Arr::get($data, 'space_no')]),
shouldOpenInNewTab: true
)
->icon('heroicon-s-download')
->visible(function ($record) {
$transactions = Transaction::find($record->transaction_ids);
$flag = false;
foreach ($transactions as $k => $transaction) {
if ($transaction->sub_master_id == config('constants.transaction_types.cm_request')) {
$flag = true;
break;
}
}
return ($flag) ? true : false;
})
->form([
TextInput::make('space_no')->numeric()->minValue(0)->required(),
])
->modalWidth('xl')
->modalbutton('Print Lable'), this is the code.
3 Replies
Please read #✅┊rules on code formatting or the pinned post.
You cannot use
->action()
and ->url()
together. But you can use ->action()
with a redirect()
I want open the file in a new tab
That won't work in that case.