samedi 7 juillet 2018

Laravel delete "link" in database using soft deletes

So I'm wondering, I have 3 tables sport, preset and sport_has_presets. Now The sport_has_presets is the link between the preset and sport. It also includes an deleted_at field, to softdelete the link. Now, I use this code in my Sport.php model;

public function presets()
    {
        return $this->belongsToMany(Preset::class, 'sport_has_presets', 'sport_id', 'preset_id')->withTimestamps();
    }

Now, this just doesn't work like when I want to get the camera's from the links that are soft deleted, but the preset still must exist and can be seen (so the preset can't be soft deleted, the link must be). Hope you understand what I mean, but it doesn't work for me now :(



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire