From 52eb78c1882bc995d60196bbce6b45c74b65471a Mon Sep 17 00:00:00 2001 From: Juan Felipe Duarte <70235683+DuarteJFelipe@users.noreply.github.com> Date: Fri, 27 Jun 2025 09:25:37 -0700 Subject: [PATCH] roles reservados --- app/Http/Livewire/ShowRoles.php | 11 +++++++++++ 1 file changed, 11 insertions(+) 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;