12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace App\Repositories\Models\Course;
- use App\Repositories\Models\Model;
- use App\Repositories\Models\Base\User;
- use Prettus\Repository\Contracts\Transformable;
- use Prettus\Repository\Traits\TransformableTrait;
- /**
- * Class CourseComment.
- *
- * @package namespace App\Repositories\Models;
- */
- class Comment extends Model implements Transformable
- {
- use TransformableTrait;
- protected $table = 'course_comments';
- /**
- * The attributes that are mass assignable.
- *
- * @var array
- */
- protected $guarded = [];
- public function user()
- {
- return $this->belongsTo(User::class, 'user_id', 'id')->select(['id', 'name', 'username', 'mobile']);
- }
- public function course()
- {
- return $this->belongsTo(Course::class)->with(['thumb_resource'])->select(['id', 'title', 'thumb', 'labels']);
- }
- public function video()
- {
- return $this->belongsTo(Video::class)->select(['id', 'title']);
- }
- }
|