/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $modulo = Modulo::find($id);
     $acciones = Accion::all();
     $roles = Role::all();
     return view('admin.su.modulos.formModulo')->with('modulo', $modulo)->with('acciones', $acciones)->with('roles', $roles);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $user = User::find($id);
     $roles = Role::all();
     $cargos = $user->cargos;
     $urgs = Urg::all();
     //Verifica si el rol del usuario es Administrador
     $user_actual = \Auth::user();
     $arr_roles = $user_actual->roles()->lists('role_name')->all();
     if (array_search('Administrador', $arr_roles) !== false) {
         $role_admin = true;
         $usuarios = User::all()->sortBy('nombre')->lists('nombre', 'id')->all();
     } else {
         $role_admin = false;
         $usuarios = [];
     }
     return view('admin.usuarios.formUsuario')->with('user', $user)->with('roles', $roles)->with('cargos', $cargos)->with('urgs', $urgs)->with('role_admin', $role_admin)->with('usuarios', $usuarios);
 }
 public function run()
 {
     Model::unguard();
     $root = Role::create(array('role_name' => 'Root'));
     $root->modulos()->attach([1, 2, 3]);
     Role::create(array('role_name' => 'Administrador'));
     Role::create(array('role_name' => 'Usuario'));
     Role::create(array('role_name' => 'Adquisiciones'));
     Role::create(array('role_name' => 'Cotizador'));
     Role::create(array('role_name' => 'Patrimonio'));
     Role::create(array('role_name' => 'Directivo'));
     Role::create(array('role_name' => 'Recepción'));
     Role::create(array('role_name' => 'Presupuesto'));
     Role::create(array('role_name' => 'Ejecutora'));
     Role::create(array('role_name' => 'Contabilidad'));
     Role::create(array('role_name' => 'Comprobacion'));
     Role::create(array('role_name' => 'Bancos'));
     Role::create(array('role_name' => 'Fondos Externos'));
     Role::create(array('role_name' => 'DMCYP - DIP'));
     Role::create(array('role_name' => 'Usuario (Solicitud)'));
 }