<?php

namespace App\Models\Members;

use App\Models\Permissions\Role;
use App\Models\Tenants\Tenant;
use App\Traits\Auditable;
use App\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * @mixin IdeHelperUserRole
 */
class UserRole extends Model
{
    use Auditable, BelongsToTenant, SoftDeletes;

    protected $fillable = [
        'user_id', 'tenant_id', 'role_id', 'assigned_at',
    ];

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function tenant()
    {
        return $this->belongsTo(Tenant::class);
    }

    public function role()
    {
        return $this->belongsTo(Role::class);
    }
}
