Attach.php 818 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Repositories\Models\Course;
  3. use App\Repositories\Models\Model;
  4. use App\Repositories\Models\Base\Resource;
  5. use Prettus\Repository\Contracts\Transformable;
  6. use Prettus\Repository\Traits\TransformableTrait;
  7. /**
  8. * Class CourseAttach.
  9. *
  10. * @package namespace App\Repositories\Models;
  11. */
  12. class Attach extends Model implements Transformable
  13. {
  14. use TransformableTrait;
  15. protected $table = 'course_attaches';
  16. /**
  17. * The attributes that are mass assignable.
  18. *
  19. * @var array
  20. */
  21. protected $guarded = [];
  22. public function course_video()
  23. {
  24. return $this->belongsTo(Video::class, 'course_video_id', 'id');
  25. }
  26. public function path_resource()
  27. {
  28. return $this->belongsTo(Resource::class, 'path', 'id')->select(['path', 'id', 'url']);
  29. }
  30. }