From 8b86cddb3379c0affd9a1612f80a123c7d056af1 Mon Sep 17 00:00:00 2001 From: ale Date: Fri, 20 Jun 2025 01:20:29 -0300 Subject: [PATCH] Agregado rol de ollas y usuarios para cada barrio --- .../2025_06_20_040800_user_role_ollas.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 database/migrations/2025_06_20_040800_user_role_ollas.php diff --git a/database/migrations/2025_06_20_040800_user_role_ollas.php b/database/migrations/2025_06_20_040800_user_role_ollas.php new file mode 100644 index 0000000..eaeb1d7 --- /dev/null +++ b/database/migrations/2025_06_20_040800_user_role_ollas.php @@ -0,0 +1,40 @@ + 'ollas']); + $barrios = GrupoDeCompra::all(); + foreach ($barrios as $barrio) { + $barrio->users()->firstOrCreate([ + 'name' => $barrio->nombre . '_ollas', + 'password' => Hash::make('123'), + 'role_id' => $ollasRol->id + ]); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $ollasRol = UserRole::where('nombre', 'ollas')->firstOrFail(); + User::where('role_id', $ollasRol->id)->delete(); + $ollasRol->delete(); + } +}