DZUSILL
DZUSILL
FFilament
Created by DZUSILL on 8/13/2024 in #❓┊help
Redirect after custom action
Thanks.
16 replies
FFilament
Created by DZUSILL on 8/13/2024 in #❓┊help
Redirect after custom action
How could I do that, please? Sorry, I'm new in the Filament
16 replies
FFilament
Created by DZUSILL on 8/13/2024 in #❓┊help
Redirect after custom action
😕
16 replies
FFilament
Created by DZUSILL on 8/13/2024 in #❓┊help
Redirect after custom action
Hi, that doesn't, it opens the page, not the modal after the redirect
16 replies
FFilament
Created by DZUSILL on 8/13/2024 in #❓┊help
Redirect after custom action
return $infolist
->schema([
Section::make('Bank details')
->description('Send here:')
->icon('heroicon-m-building-library')
->columns([
'sm' => 1,
'xl' => 2,
])
->schema([
TextEntry::make('post')
->prefix('#')
->state(fn($record) => $record->post_id ?? $record->banner_id),
TextEntry::make('payment_type'),
TextEntry::make('bank_account'),
TextEntry::make('variable_symbol')
->state(fn($record) => $record->id),
]),
]);
return $infolist
->schema([
Section::make('Bank details')
->description('Send here:')
->icon('heroicon-m-building-library')
->columns([
'sm' => 1,
'xl' => 2,
])
->schema([
TextEntry::make('post')
->prefix('#')
->state(fn($record) => $record->post_id ?? $record->banner_id),
TextEntry::make('payment_type'),
TextEntry::make('bank_account'),
TextEntry::make('variable_symbol')
->state(fn($record) => $record->id),
]),
]);
16 replies
FFilament
Created by DZUSILL on 8/13/2024 in #❓┊help
Redirect after custom action
I have a PostResource, where there is an action to top the post. After clicking the custom action "top", it creates a Payment with the current post_id what user wants to top. After the Payment is created, I have a PaymentResource, where I want the user to be redirect, or just simply show him $infolist in the PaymentResource, where are all details to pay for topping the post. The custom action in PostResource:
return $table
->actions([
Action::make('top')
->action(function (array $data, Post $post, $livewire) {
$payment = new Payment();

$payment->post()->associate($post);
$payment->user()->associate(auth()->user());
$payment->type = $data['type'];
$payment->price = getPostDetail($data['type'])->price;

$payment->save();
$payment->user->notify(new PaymentCreated($payment));

Notification::make()
->title('You have created a new payment.')
->icon('heroicon-o-check-circle')
->iconColor('success')
->send();

$livewire->redirect(route('filament.admin.resources.payments.view', ['record' => $payment->id]));
}),
]),
]);
return $table
->actions([
Action::make('top')
->action(function (array $data, Post $post, $livewire) {
$payment = new Payment();

$payment->post()->associate($post);
$payment->user()->associate(auth()->user());
$payment->type = $data['type'];
$payment->price = getPostDetail($data['type'])->price;

$payment->save();
$payment->user->notify(new PaymentCreated($payment));

Notification::make()
->title('You have created a new payment.')
->icon('heroicon-o-check-circle')
->iconColor('success')
->send();

$livewire->redirect(route('filament.admin.resources.payments.view', ['record' => $payment->id]));
}),
]),
]);
The infolist (I want to show after redirect in modal) in the PaymentResource:
16 replies
FFilament
Created by DZUSILL on 8/13/2024 in #❓┊help
Redirect after custom action
I made so far in the action function:
$livewire->redirect(route('filament.admin.resources.payments.view', ['record' => $payment->id]));
$livewire->redirect(route('filament.admin.resources.payments.view', ['record' => $payment->id]));
made custom page with view record parameter and view-payment.blade file:
<x-filament::page>
<x-filament::infolist :record="$payment" />
</x-filament::page>
<x-filament::page>
<x-filament::infolist :record="$payment" />
</x-filament::page>
but this opens a whole new page, not the modal as I want to
16 replies
FFilament
Created by DZUSILL on 8/13/2024 in #❓┊help
Redirect after custom action
Anyone, please? 😔
16 replies