I am using a pivot table implement many to many relation on Criteria model.
I've noticed that when deleting a criteria, the related rows for the deleted criteria in the pivot table is automatically deleted too.
Although I didn't add any setup for that, is this normal? Can someone explain this please?
Below are the models:
class Criteria extends Model {
protected $table = 'criterias';
public function criterias()
{
return $this->belongsToMany('App\Criteria', 'criteria_criteria', 'central_criteria_id', 'criteria_id');
}
}
class CriteriaCriteria extends Model {
protected $table = 'criteria_criteria';
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire