<?php

namespace App\Models\Core\Auth;

use Illuminate\Database\Eloquent\Model;

class PermissionRole extends Model
{
    protected $table = 'permission_role';

    public function permission()
    {
        return $this->belongsTo(\App\Models\Core\Auth\Permission::class);
    }

    public function role()
    {
        return $this->belongsTo(\App\Models\Core\Auth\Role::class);
    }

    public function scopeByPermission($query, $id)
    {
        return $query->where('permission_id', $id);
    }

    public function scopeByRole($query, $id)
    {
        return $query->where('role_id', $id);
    }
}
