Render a Modal after Create

Is it possible to render a modal after creating a record in CreateResource? I tried Action::make, but didn't work

<?php

namespace App\Filament\Resources\ClienteResource\Pages;

use App\Filament\Resources\ClienteResource;
use App\Models\Sorteio;
use Filament\Actions\Action;
use Filament\Resources\Pages\CreateRecord;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class CreateCliente extends CreateRecord
{
    protected static string $resource = ClienteResource::class;
    
    protected function handleRecordCreation(array $data): Model
    {

        try {
            
            DB::beginTransaction();
            $novoCliente = static::getModel()::create($data);
            $sorteios = Sorteio::disponiveis($novoCliente);
            
            if ($sorteios) {
                $arraySorteios = $sorteios->pluck('id')->toArray();
                $novoCliente->sorteios()->sync($arraySorteios);
            }
            
            DB::commit();
            return $novoCliente;
            
        } catch (\Exception $e) {
            
            DB::rollBack();
            throw $e;
            
        } catch (\Throwable $e) {
            
            DB::rollBack();
            throw $e;
            
        }

    }
    
    protected function afterCreate(): void {
        Action::make('modal')
            ->requiresConfirmation();
    }
    
    protected function getRedirectUrl(): string
    {
        return '/clientes/create';
    }
    
    /*    public function __call($name, $arguments)
        {
            // Verifica se o método chamado é o 'handleRecordCreation' e executa ele
            if ($name === 'handleRecordCreation') {
                return $this->handleRecordCreation(...$arguments);
            }
    
            // Se o método não for reconhecido, lança uma exceção
            throw new \BadMethodCallException("Método $name não encontrado");
        }*/
}
Solution
I created a livewire component and redirected to it on redirectUrl() function
Was this page helpful?