Attach.php 1014 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. protected static function booted()
  17. {
  18. self::language();
  19. // static::creating(function (Attach $model) {
  20. //
  21. // $model->attributes['language']
  22. // });
  23. }
  24. /**
  25. * The attributes that are mass assignable.
  26. *
  27. * @var array
  28. */
  29. protected $guarded = [];
  30. public function course_video()
  31. {
  32. return $this->belongsTo(Video::class, 'course_video_id', 'id');
  33. }
  34. public function path_resource()
  35. {
  36. return $this->belongsTo(Resource::class, 'path', 'id')->select(['path', 'id', 'url']);
  37. }
  38. }