hasMany(Lesson::class); } public function getRouteKeyName() { return 'slug'; } public function getLesson($slug) { return $this->lessons()->where('slug', $slug)->first(); } }