<?php

declare(strict_types=1);

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

final class Permission extends Model
{
    protected $fillable = ['code', 'name', 'type', 'parent_code', 'menu_path', 'icon', 'sort'];

    public function roles(): BelongsToMany
    {
        return $this->belongsToMany(User::class, 'role_permissions', 'permission_id', 'role', 'id', 'role');
    }
}
