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.

30 lines
516 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',
);
}
}