20 lines
398 B
PHP
20 lines
398 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\User;
|
|
use Spatie\Permission\Models\Role;
|
|
|
|
class Rol extends Role
|
|
{
|
|
public function usuarios()
|
|
{
|
|
return $this->belongsToMany(
|
|
User::class,
|
|
'model_has_roles',
|
|
'role_id',
|
|
'model_id'
|
|
)->wherePivot('model_type', User::class)
|
|
->withPivotValue('model_type', User::class);
|
|
}
|
|
} |