roles reservados
This commit is contained in:
@@ -17,6 +17,8 @@ class ShowRoles extends Component
|
|||||||
public $ro;
|
public $ro;
|
||||||
public $filtro_id;
|
public $filtro_id;
|
||||||
|
|
||||||
|
protected $nombres_reservados = ['super', 'administrador'];
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
if (auth()->user()->rol_id == 5) {
|
if (auth()->user()->rol_id == 5) {
|
||||||
@@ -48,6 +50,15 @@ class ShowRoles extends Component
|
|||||||
|
|
||||||
public function crear()
|
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)) {
|
if (!empty($this->nombre)) {
|
||||||
$crear_rol = new Role;
|
$crear_rol = new Role;
|
||||||
$crear_rol->nombre = $this->nombre;
|
$crear_rol->nombre = $this->nombre;
|
||||||
|
|||||||
Reference in New Issue
Block a user