<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Comment extends BaseModel
{
    use HasFactory;

    public function role()
    {
        return $this->hasOneThrough(ServiceRole::class, ServiceRoleUser::class, 'user_id', 'id', 'user_id', 'role_id');
    }

    public function user()
    {
        return $this->belongsTo(ServiceUser::class, 'user_id', 'user_id');
    }

    public function order(){
        return $this->hasOne(Order::class,'id','commentable_id');
    }
}
