From 0d779772f6407e0d02c5fffb9c2c6ed06b3b7593 Mon Sep 17 00:00:00 2001
From: DiegoAndresMejia
Date: Mon, 9 Dec 2024 02:53:55 -0500
Subject: [PATCH 1/2] add: add the lottery name in the raffle card
---
resources/js/Components/Dashboard/RaffleCard.vue | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/resources/js/Components/Dashboard/RaffleCard.vue b/resources/js/Components/Dashboard/RaffleCard.vue
index 8ca3214..638899d 100644
--- a/resources/js/Components/Dashboard/RaffleCard.vue
+++ b/resources/js/Components/Dashboard/RaffleCard.vue
@@ -39,7 +39,7 @@
Números disponibles: {{ raffle.total_tickets }}
- Total vendido: ${{ raffle.total_sales }}
+ Loteria: {{ raffle.lottery ? raffle.lottery.name : 'No especificada' }}
@@ -220,7 +220,6 @@ import { TransitionRoot, TransitionChild, Dialog, DialogPanel } from '@headlessu
import axios from "axios";
-/* Props and Reactive Data */
const raffleProps = defineProps({ raffle: Object });
const showSelectionModal = ref(false);
const showModal = ref(false);
@@ -333,7 +332,7 @@ const clearSelection = () => {
const selectRandomNumbers = () => {
const availableNumbers = paginatedNumbers.value;
const randomNumbers = [];
- while (randomNumbers.length < 5 && availableNumbers.length > 0) {
+ while (randomNumbers.length < 2 && availableNumbers.length > 0) {
const randomIndex = Math.floor(Math.random() * availableNumbers.length);
const number = availableNumbers[randomIndex];
if (!randomNumbers.includes(number)) {
From ea97454786842be9090d9f04ee9ba029cee6ac20 Mon Sep 17 00:00:00 2001
From: DiegoAndresMejia
Date: Mon, 9 Dec 2024 03:28:18 -0500
Subject: [PATCH 2/2] add: add in the lottery table the news lotteries from the
lottery api
---
...24_12_09_080953_update_lotteries_table.php | 33 +++++
database/seeders/DatabaseSeeder.php | 2 +
database/seeders/LotterySeeder.php | 135 ++++++++++++++++++
3 files changed, 170 insertions(+)
create mode 100644 database/migrations/2024_12_09_080953_update_lotteries_table.php
create mode 100644 database/seeders/LotterySeeder.php
diff --git a/database/migrations/2024_12_09_080953_update_lotteries_table.php b/database/migrations/2024_12_09_080953_update_lotteries_table.php
new file mode 100644
index 0000000..96cfe57
--- /dev/null
+++ b/database/migrations/2024_12_09_080953_update_lotteries_table.php
@@ -0,0 +1,33 @@
+text('description')->nullable()->change();
+ $table->string('url_imagen')->nullable()->change();
+
+ $table->string('slug')->unique()->after('name');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('lotteries', function (Blueprint $table) {
+ $table->text('description')->nullable(false)->change();
+ $table->string('url_imagen')->nullable(false)->change();
+ $table->dropColumn('slug');
+ });
+ }
+};
diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php
index 450e5f9..873f9ce 100644
--- a/database/seeders/DatabaseSeeder.php
+++ b/database/seeders/DatabaseSeeder.php
@@ -15,6 +15,8 @@ class DatabaseSeeder extends Seeder
public function run(): void
{
+ $this->call(LotterySeeder::class);
+
$this->call([
RolesPermissionsSeeder::class,
]);
diff --git a/database/seeders/LotterySeeder.php b/database/seeders/LotterySeeder.php
new file mode 100644
index 0000000..fb52b13
--- /dev/null
+++ b/database/seeders/LotterySeeder.php
@@ -0,0 +1,135 @@
+ "ANTIOQUEÑITA MAÑANA FESTIVO", "slug" => "antioquenita-manana-festivo"],
+ ["name" => "ANTIOQUEÑITA TARDE FESTIVO", "slug" => "antioquenita-tarde-festivo"],
+ ["name" => "CARIBEÑA DIA FESTIVO", "slug" => "caribena-dia-festivo"],
+ ["name" => "CHONTICO DIA FESTIVO", "slug" => "chontico-dia-festivo"],
+ ["name" => "CULONA DIA FESTIVO", "slug" => "culona-dia-festivo"],
+ ["name" => "MOTILON DIA", "slug" => "motilon-dia"],
+ ["name" => "PAISITA DIA FESTIVO", "slug" => "paisita-dia-festivo"],
+ ["name" => "SAMAN FESTIVO", "slug" => "saman-festivo"],
+ ["name" => "SINUANO DIA FESTIVO", "slug" => "sinuano-dia-festivo"],
+ ["name" => "ANTIOQUEÑITA FESTIVA MAÑANA", "slug" => "antioqueaita-festiva-maaana"],
+ ["name" => "ANTIOQUEÑITA FESTIVA TARDE", "slug" => "antioqueaita-festiva-tarde"],
+ ["name" => "ANTIOQUEÑITA MAÑANA", "slug" => "antioqueaita-maaana"],
+ ["name" => "ANTIOQUEÑITA TARDE", "slug" => "antioqueaita-tarde"],
+ ["name" => "ANTIOQUEÑITA FESTIVA MAÑANA", "slug" => "antioquenita-festiva-manana"],
+ ["name" => "ANTIOQUEÑITA FESTIVA TARDE", "slug" => "antioquenita-festiva-tarde"],
+ ["name" => "ANTIOQUEÑITA MAÑANA", "slug" => "antioquenita-manana"],
+ ["name" => "ANTIOQUEÑITA TARDE", "slug" => "antioquenita-tarde"],
+ ["name" => "AST-LUN 21:50", "slug" => "ast-lun-2150"],
+ ["name" => "AST-SOL 13:50", "slug" => "ast-sol-1350"],
+ ["name" => "ASTRO LUNA", "slug" => "astro-luna"],
+ ["name" => "ASTRO SOL", "slug" => "astro-sol"],
+ ["name" => "BOGOTA", "slug" => "bogota"],
+ ["name" => "BOYACA", "slug" => "boyaca"],
+ ["name" => "CAFETERITO FESTIVO", "slug" => "cafeterito-festivo"],
+ ["name" => "CAFETERITO NOCHE", "slug" => "cafeterito-noche"],
+ ["name" => "CAFETERITO NOCHE FESTIVO", "slug" => "cafeterito-noche-festivo"],
+ ["name" => "CAFETERO", "slug" => "cafetero"],
+ ["name" => "CAFETERO DIA", "slug" => "cafetero-dia"],
+ ["name" => "CAFETERO NOCHE", "slug" => "cafetero-noche"],
+ ["name" => "CAFETERO NOCHE FESTIVO", "slug" => "cafetero-noche-festivo"],
+ ["name" => "CARIBEÑA DIA", "slug" => "caribeaa-dia"],
+ ["name" => "CARIBEÑA FESTIVO DIA", "slug" => "caribeaa-festivo-dia"],
+ ["name" => "CARIBEÑA NOCHE", "slug" => "caribeaa-noche"],
+ ["name" => "CARIBEÑA DIA", "slug" => "caribena-dia"],
+ ["name" => "CARIBEÑA FESTIVA NOCHE", "slug" => "caribena-festiva-noche"],
+ ["name" => "CARIBEÑA FESTIVO DIA", "slug" => "caribena-festivo-dia"],
+ ["name" => "CARIBEÑA NOCHE", "slug" => "caribena-noche"],
+ ["name" => "CARIBEÑA NOCHE FESTIVO", "slug" => "caribena-noche-festivo"],
+ ["name" => "CAUCA", "slug" => "cauca"],
+ ["name" => "CHONTICO", "slug" => "chontico"],
+ ["name" => "CHONTICO DIA", "slug" => "chontico-dia"],
+ ["name" => "CHONTICO FESTIVO", "slug" => "chontico-festivo"],
+ ["name" => "CHONTICO FESTIVO DIA", "slug" => "chontico-festivo-dia"],
+ ["name" => "CHONTICO NOCHE", "slug" => "chontico-noche"],
+ ["name" => "CHONTICO NOCHE FESTIVO", "slug" => "chontico-noche-festivo"],
+ ["name" => "CHONTICO NOCHE JUEVES", "slug" => "chontico-noche-jueves"],
+ ["name" => "CRUZ ROJA", "slug" => "cruz-roja"],
+ ["name" => "CULONA", "slug" => "culona"],
+ ["name" => "CULONA DIA", "slug" => "culona-dia"],
+ ["name" => "CULONA FESTIVO", "slug" => "culona-festivo"],
+ ["name" => "CULONA FESTIVO DIA", "slug" => "culona-festivo-dia"],
+ ["name" => "CULONA FESTIVO NOCHE", "slug" => "culona-festivo-noche"],
+ ["name" => "CULONA NOCHE", "slug" => "culona-noche"],
+ ["name" => "CULONA NOCHE FESTIVO", "slug" => "culona-noche-festivo"],
+ ["name" => "CUNDINAMARCA", "slug" => "cundinamarca"],
+ ["name" => "DORADO", "slug" => "dorado"],
+ ["name" => "DORADO FESTIVO", "slug" => "dorado-festivo"],
+ ["name" => "DORADO MAÑANA", "slug" => "dorado-manana"],
+ ["name" => "DORADO NOCHE", "slug" => "dorado-noche"],
+ ["name" => "DORADO NOCHE FESTIVO", "slug" => "dorado-noche-festivo"],
+ ["name" => "DORADO TARDE", "slug" => "dorado-tarde"],
+ ["name" => "EXTRA CRUZ ROJA", "slug" => "extra-cruz-roja"],
+ ["name" => "EXTRA DE COLOMBIA", "slug" => "extra-de-colombia"],
+ ["name" => "FANTASTICA DIA", "slug" => "fantastica-dia"],
+ ["name" => "FANTASTICA NOCHE", "slug" => "fantastica-noche"],
+ ["name" => "FANTASTICA NOCHE FESTIVO", "slug" => "fantastica-noche-festivo"],
+ ["name" => "HUILA", "slug" => "huila"],
+ ["name" => "LA FANTASTICA DIA", "slug" => "la-fantastica-dia"],
+ ["name" => "LA FANTASTICA FESTIVO", "slug" => "la-fantastica-festivo"],
+ ["name" => "LA FANTASTICA NOCHE", "slug" => "la-fantastica-noche"],
+ ["name" => "LA FANTASTICA NOCHE FESTIVO", "slug" => "la-fantastica-noche-festivo"],
+ ["name" => "MANIZALES", "slug" => "manizales"],
+ ["name" => "MEDELLIN", "slug" => "medellin"],
+ ["name" => "META", "slug" => "meta"],
+ ["name" => "MOTILON", "slug" => "motilon"],
+ ["name" => "MOTILON FESTIVO", "slug" => "motilon-festivo"],
+ ["name" => "MOTILON NOCHE", "slug" => "motilon-noche"],
+ ["name" => "PAISITA 3 SABADOS", "slug" => "paisita-3-sabados"],
+ ["name" => "PAISITA DIA", "slug" => "paisita-dia"],
+ ["name" => "PAISITA FESTIVO", "slug" => "paisita-festivo"],
+ ["name" => "PAISITA FESTIVO DIA", "slug" => "paisita-festivo-dia"],
+ ["name" => "PAISITA FESTIVO NOCHE", "slug" => "paisita-festivo-noche"],
+ ["name" => "PAISITA NOCHE", "slug" => "paisita-noche"],
+ ["name" => "PAISITA NOCHE FESTIVO", "slug" => "paisita-noche-festivo"],
+ ["name" => "PIJAO", "slug" => "pijao"],
+ ["name" => "PIJAO FESTIVO", "slug" => "pijao-festivo"],
+ ["name" => "PIJAO NOCHE FESTIVO", "slug" => "pijao-noche-festivo"],
+ ["name" => "QUINDIO", "slug" => "quindio"],
+ ["name" => "RISARALDA", "slug" => "risaralda"],
+ ["name" => "SAMAN", "slug" => "saman"],
+ ["name" => "SAMANFESTIVO", "slug" => "samanfestivo"],
+ ["name" => "SANTANDER", "slug" => "santander"],
+ ["name" => "SINUANO DIA", "slug" => "sinuano-dia"],
+ ["name" => "SINUANO FESTIVO DIA", "slug" => "sinuano-festivo-dia"],
+ ["name" => "SINUANO FESTIVO NOCHE", "slug" => "sinuano-festivo-noche"],
+ ["name" => "SINUANO NOCHE", "slug" => "sinuano-noche"],
+ ["name" => "SINUANO NOCHE FESTIVO", "slug" => "sinuano-noche-festivo"],
+ ["name" => "SORTEO EXTRA CAUCA", "slug" => "sorteo-extra-cauca"],
+ ["name" => "SORTEO EXTRA CRUZROJA-VALLE", "slug" => "sorteo-extra-cruzroja-valle"],
+ ["name" => "SORTEO EXTRA DE BOGOTA", "slug" => "sorteo-extra-de-bogota"],
+ ["name" => "SORTEO EXTRA DE BOYACA", "slug" => "sorteo-extra-de-boyaca"],
+ ["name" => "SORTEO EXTRA DE MANIZALES", "slug" => "sorteo-extra-de-manizales"],
+ ["name" => "SORTEO EXTRA DEL TOLIMA", "slug" => "sorteo-extra-del-tolima"],
+ ["name" => "SORTEO EXTRA SANTANDER", "slug" => "sorteo-extra-santander"],
+ ["name" => "SUPER EXTRA MEDELLIN", "slug" => "super-extra-medellin"],
+ ["name" => "SUPER EXTRA NAVIDAD MEDELLIN", "slug" => "super-extra-navidad-medellin"],
+ ["name" => "TOLIMA", "slug" => "tolima"],
+ ["name" => "VALLE", "slug" => "valle"]
+ ];
+
+ foreach ($lotteries as $lottery) {
+ Lottery::create([
+ 'name' => $lottery['name'],
+ 'slug' => $lottery['slug'],
+ 'description' => 'Descripción predeterminada para la lotería ' . $lottery['name'],
+ 'url_imagen' => 'https://via.placeholder.com/150', // URL de imagen predeterminada
+ ]);
+ }
+ }
+}