1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\SoftDeletes;
- class CoachOrderComment extends Model
- {
- use HasFactory, SoftDeletes;
- protected $table = 'coach_order_comments';
- protected $fillable = [
- 'order_id',
- 'user_id',
- 'coach_id',
- 'score',
- 'content',
- 'images',
- 'is_anonymous',
- 'status',
- ];
- protected $casts = [
- 'images' => 'array',
- 'score' => 'integer',
- 'is_anonymous' => 'boolean',
- 'status' => 'integer',
- ];
- /**
- * 获取评价的标签
- */
- public function tags()
- {
- return $this->belongsToMany(CoachCommentTag::class, 'coach_order_comment_tags', 'comment_id', 'tag_id')
- ->withTimestamps();
- }
- /**
- * 获取评价的用户
- */
- public function user()
- {
- return $this->belongsTo(MemberUser::class, 'user_id');
- }
- /**
- * 获取评价的技师
- */
- public function coach()
- {
- return $this->belongsTo(CoachUser::class, 'coach_id');
- }
- /**
- * 获取评价的订单
- */
- public function order()
- {
- return $this->belongsTo(Order::class, 'order_id');
- }
- }
|