@abdulbazith You need to decide first if 1 chapter belongs to more subjects.
I would say tables should be like
classes ( id, name ) //slug or others if you want
subjects (id, name ) // slug or others if you want
chapters(id, name, subject_id) // this belongs to a subject so it's a "child"
topics (id, name, chapter_id) // topic is child of chapter
class_topic (id, class_id, topic_id) // this is the pivot table because each class studies a topic...
So then you have class < - > topic relationship
and topic -> chapter -> subject relationships...
In your example it's like the following
$class_5 = ClassObject::find(5);
$topics = $class_5->topics()->get();
// iterate and display topic->name