I have one issue when i delete parent i want to delete all child of from different modal.i want when i delete category delete all course of category and delete all chapter of course and delete all exams of chapter
category child is course
course child is chapter
chapter child is exams
//Category modal
public function courses()
{
return $this->hasMany(Course::class);
}
// Course Model
public function category()
{
return $this->belongsTo(Category::class);
}
public function chapters()
{
return $this->hasMany(CourseChapter::class);
}
// Chapter model
public function course()
{
return $this->belongsTo(Course::class);
}
public function exams()
{
return $this->hasMany(Exam::class);
}