<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\RelationNotFoundException;
use Illuminate\Database\Eloquent\RelationFoundException;
use Illuminate\Database\Eloquent\Relation;

use Eloquent as Model;

class Permiso extends Model
{
    protected $connection = 'mysql';
    protected $table = 'Permiso';
    public $timestamps = false;
    protected $primaryKey = 'idpermiso';
    //protected $primaryKey= ['idrol', 'idpagina'];
    use HasFactory;

    public $fillable = [
        'idrol',
        'idpagina',
        'estado',
    ];


    /*** @return \Illuminate\Database\Eloquent\Relations\BelongsTo **/
      public function roles()
      {
         return $this->belongsTo(\App\Models\Rol::class, 'idrol');
      }
 
      public function paginas()
      {
          return $this->belongsTo(\App\Models\Pagina::class, 'idpagina');
      }
}
