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.

35 lines
602 B
PHP

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