You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
monitor-doc/app/Models/Role.php

38 lines
668 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
use HasFactory;
protected $fillable = [
'name'
];
public function users()
{
return $this->hasMany(User::class);
}
public function permissions()
{
return $this->hasManyThrough(
Permission::class,
RolePermission::class,
'role_id',
'id',
'id',
'permission_id',
);
}
public function rolePermissions()
{
return $this->hasMany(RolePermission::class);
}
}