Your IP : 3.145.152.49


Current Path : /home/lentoinv/api.lentoria.com/app/Models/
Upload File :
Current File : //home/lentoinv/api.lentoria.com/app/Models/Section.php

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\Course;
use App\Models\Lecture;

class Section extends Model
{
    use HasFactory;

    protected $guarded = [];

    public function course()
    {
        return $this->belongsTo(Course::class);
    }

    public function lectures()
    {
        return $this->hasMany(Lecture::class);
    }
    
    public function nextSection()
    {
        return $this->course->sections()
            ->where('order', '>', $this->order)
            ->orderBy('order', 'ASC')
            ->first();
    }
}

?>