1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace App\Repositories\Models\Course;
- use App\Repositories\Models\Model;
- use App\Repositories\Models\Base\Resource;
- use Prettus\Repository\Contracts\Transformable;
- use Prettus\Repository\Traits\TransformableTrait;
- /**
- * Class Course.
- *
- * @package namespace App\Repositories\Models;
- */
- class Course extends Model implements Transformable
- {
- use TransformableTrait;
- protected $table = 'course_courses';
- /**
- * The attributes that are mass assignable.
- *
- * @var array
- */
- protected $guarded = [];
- protected static function booted()
- {
- self::language();
- }
- public function category()
- {
- return $this->belongsTo(Category::class, 'category_id', 'id');
- }
- public function thumb_resource()
- {
- return $this->belongsTo(Resource::class, 'thumb', 'id')->select(['path', 'id', 'url']);
- }
- public function attaches()
- {
- return $this->hasMany(Attach::class, 'course_id', 'id');
- }
- public function subscribe()
- {
- return $this->hasOne(UserRecord::class);
- }
- public function comments()
- {
- return $this->hasMany(Comment::class);
- }
- }
|