<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Lesson extends Model
{
	protected $fillable = ['chapter_id','lesson_section_id','title','description','order', 'slug'];

    //protected $fillable = ['lesson_section_id', 'title', 'description', 'video_url', 'order'];

    public function lessonSection()
    {
        return $this->belongsTo(LessonSection::class);
    }
	
	public function chapter()
	{
		return $this->belongsTo(Chapter::class);
	}	

	public function videos()
	{
		return $this->hasMany(LessonVideo::class)->orderBy('order');
	}

	public function progress()
	{
		return $this->hasMany(LessonProgress::class);
	}

	public function questions()
	{
		return $this->hasMany(LessonQuestion::class);
	}

}
