WatchRecord.php 781 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace App\Repositories\Models\Course;
  3. use App\Repositories\Models\Model;
  4. use App\Repositories\Models\Base\User;
  5. class WatchRecord extends Model
  6. {
  7. /**
  8. * @var string
  9. */
  10. protected $table = 'course_watch_records';
  11. protected $guarded = [];
  12. /**
  13. * The attributes excluded from the model's JSON form.
  14. *
  15. * @var array
  16. */
  17. protected $hidden = [];
  18. public function user()
  19. {
  20. return $this->belongsTo(User::class, 'user_id', 'id')->select(['id', 'name', 'username', 'mobile']);
  21. }
  22. public function course()
  23. {
  24. return $this->belongsTo(Course::class)->select(['id', 'title']);
  25. }
  26. public function video()
  27. {
  28. return $this->belongsTo(Course::class)->select(['id', 'title']);
  29. }
  30. }