diff --git a/app/Http/Livewire/ShowRoles.php b/app/Http/Livewire/ShowRoles.php index ceaa497..4b052eb 100755 --- a/app/Http/Livewire/ShowRoles.php +++ b/app/Http/Livewire/ShowRoles.php @@ -17,6 +17,8 @@ class ShowRoles extends Component public $ro; public $filtro_id; + protected $nombres_reservados = ['super', 'administrador']; + public function render() { if (auth()->user()->rol_id == 5) { @@ -48,6 +50,15 @@ class ShowRoles extends Component public function crear() { + $nombre_limpio = strtolower(trim($this->nombre)); + + if (in_array($nombre_limpio, $this->nombres_reservados)) { + $this->alert('warning', 'Este nombre de rol está reservado y no se puede usar.', [ + 'position' => 'top' + ]); + return; + } + if (!empty($this->nombre)) { $crear_rol = new Role; $crear_rol->nombre = $this->nombre;