How can I throw an exception and send a notification in handleRecordCreation() method
I am trying to send an email when I create a record
If the email was not send an exception is thrown
I am catching the exception then I am sending a notification
But I am getting this error:
App\Filament\Resources\TicketResource\Pages\CreateTicket::handleRecordCreation(): Return value must be of type Illuminate\Database\Eloquent\Model, none returned
How can I handle this?
6 Replies
You are not returning an instance of the Model outside of the try
Yes I know that
I want to send a notification that there was an error before creating the record
Then you will probably want to try this in an Observer class instead, using creating / create methods
I don't want to use Observers / beforeCreate() method because I have DB::transaction()
Do you have more context?