hasMany('App\Models\TextLessonAttachment', 'text_lesson_id', 'id'); } public function learningStatus() { return $this->hasOne('App\Models\CourseLearning', 'text_lesson_id', 'id'); } public function chapter() { return $this->belongsTo('App\Models\WebinarChapter', 'chapter_id', 'id'); } public function personalNote() { return $this->morphOne('App\Models\CoursePersonalNote', 'targetable'); } public function checkPassedItem() { $result = false; if (auth()->check()) { $check = $this->learningStatus()->where('user_id', auth()->id())->count(); $result = ($check > 0); } return $result; } }