lundi 25 mars 2019

Laravel deleting trigger nothing happens

I'have tow Models with a Relationship. So when Model A will be delete, all related Models B should be also delete. I'm working with soft deleting.

Here my trigger in Model A:

protected static function boot()
{
    parent::boot();

    // Delete Relations
    self::deleting(function (Customer $customer) {
        $customer->contacts()->delete();
    });
}

When I delete a Model A the related Models from B will not be touched. So nothing happens. So the trigger is not working. I got no error or something else. Has anyone an idea how I should find the mistake?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire