Attach.php 896 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. protected static function booted()
  23. {
  24. self::language();
  25. }
  26. public function course_video()
  27. {
  28. return $this->belongsTo(Video::class, 'course_video_id', 'id');
  29. }
  30. public function path_resource()
  31. {
  32. return $this->belongsTo(Resource::class, 'path', 'id')->select(['path', 'id', 'url']);
  33. }
  34. }