It is possible do use __construct on Edit Page?

I'm using a service on a __construct inside a create page, and it is working like a charm.
But when I use it in a EditPage, I have this error message

Target [App\Http\Services\PaymentTransaction\PaymentTransactionServiceContract] is not instantiable while building [App\Filament\Resources\PaymentIntentionResource\Pages\EditPaymentIntention].
Solution
Ok I tryed it:

    public function mount(int|string $record): void
    {
        parent::mount($record);
        $this->paymentTransactionService = app()->make(PaymentTransactionServiceContract::class);
    }

But it still not working, and I solved using app()->make() directly on beforeSave() method..

Something like this:

    protected function beforeSave(): void
    {
        app()->make(PaymentTransactionServiceContract::class)->createTransaction($this->data, $this->getRecord());
    }


Nice hint @awcodes 🙏
Was this page helpful?