UserVideoWatchRecord.php 772 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Repositories\Models;
  3. use Prettus\Repository\Contracts\Transformable;
  4. use Prettus\Repository\Traits\TransformableTrait;
  5. /**
  6. * Class CourseVideo.
  7. *
  8. * @package namespace App\Repositories\Models;
  9. */
  10. class UserVideoWatchRecord extends Model implements Transformable
  11. {
  12. use TransformableTrait;
  13. /**
  14. * The attributes that are mass assignable.
  15. *
  16. * @var array
  17. */
  18. // protected $fillable = [];
  19. protected $guarded = [];
  20. public function getDurationTextAttribute()
  21. {
  22. return sec2time($this->attributes['duration']);
  23. }
  24. public function course()
  25. {
  26. return $this->belongsTo(Course::class);
  27. }
  28. public function video()
  29. {
  30. return $this->belongsTo(CourseVideo::class);
  31. }
  32. }