<?php

namespace App\Domains\Menu\Models;

use App\Domains\Authorization\Models\Role;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\Pivot;

class MenuRole extends Pivot
{
    protected $table = 'roles_menues';

    public $incrementing = true;

    public $timestamps = false;

    protected $fillable = [
        'rol_codigo',
        'menu_codigo',
    ];

    public function role(): BelongsTo
    {
        return $this->belongsTo(Role::class, 'rol_codigo', 'codigo');
    }

    public function menu(): BelongsTo
    {
        return $this->belongsTo(Menu::class, 'menu_codigo', 'code');
    }
}
