How to edit and delete in One to Many relationships with eloquent in laravel 5.1?

0

I have a 3 tables which have the following relationships:

Events Table:

            public function modalitys()
{
    return $this->hasMany('Deportes\Models\Modality', 'events_id');
}

Modality Table:

            public function discounts()
{
    return $this->hasMany('Deportes\Models\Discount', 'modalitys_id');
}
            public function event()
{
    return $this->belongsTo('Deportes\Models\Event');
}

table discount:

    public function modality()
{
    return $this->belongsTo('Deportes\Models\Modality');
}

Is there a laravel method to edit modalities and discounts with eloquent, as well as sync and detach for 1 to 1 relations?

    
asked by Susje 29.10.2017 в 13:13
source

0 answers