Chapter.php 932 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Repositories\Models\Course;
  3. use App\Repositories\Models\Model;
  4. use Jenssegers\Mongodb\Eloquent\SoftDeletes;
  5. use Prettus\Repository\Contracts\Transformable;
  6. use Prettus\Repository\Traits\TransformableTrait;
  7. /**
  8. * Class CourseChapter.
  9. *
  10. * @package namespace App\Repositories\Models;
  11. */
  12. class Chapter extends Model implements Transformable
  13. {
  14. use TransformableTrait;
  15. use SoftDeletes;
  16. protected $table = 'course_chapters';
  17. /**
  18. * The attributes that are mass assignable.
  19. *
  20. * @var array
  21. */
  22. // protected $fillable = ['title', 'sort', 'status', 'course_id'];
  23. protected $guarded = [];
  24. protected static function booted()
  25. {
  26. self::language();
  27. }
  28. public function videos()
  29. {
  30. return $this->hasMany(Video::class, 'course_chapter_id', 'id');
  31. }
  32. public function course()
  33. {
  34. return $this->belongsTo(Course::class);
  35. }
  36. }