Node.php 849 B

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