Refactor ProgramSeeder to structure daily activities into a more organized format, replacing date keys with an array of day and activities for improved clarity and maintainability.

This commit is contained in:
2025-09-20 17:04:13 +05:00
parent 4f16b4193e
commit 68d2588af1
2 changed files with 206 additions and 170 deletions

View File

@@ -137,7 +137,7 @@ class ProgramResource extends Resource
if (is_array($data['days'])) {
foreach ($data['days'] as $day) {
if (isset($day['day']) && isset($day['activities'])) {
$days[date('d.m.Y', strtotime($day['day']))] = $day['activities'];
$days[$day['day']] = $day['activities'];
}
}
}

View File

@@ -14,7 +14,9 @@ class ProgramSeeder extends Seeder
public function run(): void
{
$days = [
'19.09.2025' => [
[
'day' => '2025-09-19',
'activities' => [
[
'time' => '05:10',
'title' => 'Jidda gonmak',
@@ -24,7 +26,7 @@ class ProgramSeeder extends Seeder
'transport' => 'plane',
],
[
'time' => '',
'time' => null,
'title' => 'Medinä gitmek',
'description' => 'Simkart almak we awtobusa ýerleşmek',
'iconSet' => 'FontAwesome',
@@ -32,7 +34,7 @@ class ProgramSeeder extends Seeder
'transport' => 'bus',
],
[
'time' => '',
'time' => null,
'title' => 'Otele ýerleşmek',
'description' => 'Otaglara ýerleşmek',
'iconSet' => 'FontAwesome',
@@ -48,7 +50,10 @@ class ProgramSeeder extends Seeder
'transport' => 'bus',
],
],
'20.09.2025' => [
],
[
'day' => '2025-09-20',
'activities' => [
[
'time' => 'günüň dowamynda',
'title' => 'Pygamberimiziň (saw) metjidi',
@@ -58,7 +63,10 @@ class ProgramSeeder extends Seeder
'transport' => 'bus',
],
],
'21.09.2025' => [
],
[
'day' => '2025-09-21',
'activities' => [
[
'time' => '07:00',
'title' => 'Zyýarat ýerleri',
@@ -68,7 +76,7 @@ class ProgramSeeder extends Seeder
'transport' => 'bus',
],
[
'time' => '',
'time' => null,
'title' => 'Kuran zawody',
'description' => 'Eger açyk bolup mümkinçilik bolsa',
'iconSet' => 'FontAwesome5',
@@ -78,17 +86,20 @@ class ProgramSeeder extends Seeder
[
'time' => 'günüň dowamynda',
'title' => 'Pygamberimiziň (saw) metjidi',
'description' => '',
'description' => null,
'iconSet' => 'FontAwesome5',
'iconName' => 'mosque',
'transport' => 'bus',
],
],
'22.09.2025' => [
],
[
'time' => '',
'day' => '2025-09-22',
'activities' => [
[
'time' => null,
'title' => 'Myhmanhanadan çykmak',
'description' => '',
'description' => null,
'iconSet' => 'FontAwesome',
'iconName' => 'hotel',
'transport' => 'bus',
@@ -96,13 +107,13 @@ class ProgramSeeder extends Seeder
[
'time' => '14:00',
'title' => 'Mekkä gitmek (Umra)',
'description' => '',
'description' => null,
'iconSet' => 'FontAwesome',
'iconName' => 'bus',
'transport' => 'bus',
],
[
'time' => '',
'time' => null,
'title' => 'Best Western oteline ýerleşmek',
'description' => 'Otaglara ýerleşmek',
'iconSet' => 'FontAwesome',
@@ -112,13 +123,16 @@ class ProgramSeeder extends Seeder
[
'time' => 'günüň dowamynda',
'title' => 'Umra zyýaraty',
'description' => '',
'description' => null,
'iconSet' => 'FontAwesome5',
'iconName' => 'kaaba',
'transport' => 'bus',
],
],
'24.09.2025' => [
],
[
'day' => '2025-09-24',
'activities' => [
[
'time' => '15:00',
'title' => 'Optom bazary',
@@ -128,7 +142,10 @@ class ProgramSeeder extends Seeder
'transport' => 'bus',
],
],
'25.09.2025' => [
],
[
'day' => '2025-09-25',
'activities' => [
[
'time' => '07:00',
'title' => 'Aýşa metjidi (Umra)',
@@ -138,27 +155,36 @@ class ProgramSeeder extends Seeder
'transport' => 'bus',
],
],
'26.09.2025' => [
],
[
'day' => '2025-09-26',
'activities' => [
[
'time' => 'günüň dowamynda',
'title' => 'Juma',
'description' => '',
'description' => null,
'iconSet' => 'FontAwesome5',
'iconName' => 'mosque',
'transport' => 'bus',
],
],
'27.09.2025' => [
],
[
'day' => '2025-09-27',
'activities' => [
[
'time' => '07:00',
'title' => 'Gyzyl deňizi we Howa enemize zyýarat',
'description' => '',
'description' => null,
'iconSet' => 'FontAwesome5',
'iconName' => 'water',
'transport' => 'bus',
],
],
'28.09.2025' => [
],
[
'day' => '2025-09-28',
'activities' => [
[
'time' => '07:00',
'title' => 'Mekke zyýaratlary',
@@ -168,50 +194,60 @@ class ProgramSeeder extends Seeder
'transport' => 'bus',
],
],
'29.09.2025' => [
],
[
'day' => '2025-09-29',
'activities' => [
[
'time' => '07:00',
'title' => 'Taif şäheri (Umra)',
'description' => '',
'description' => null,
'iconSet' => 'FontAwesome5',
'iconName' => 'mountain',
'transport' => 'bus',
],
],
'01.10.2025' => [
],
[
'day' => '2025-10-01',
'activities' => [
[
'time' => '23:00',
'title' => 'Nur dagyna çykmak',
'description' => '',
'description' => null,
'iconSet' => 'FontAwesome5',
'iconName' => 'mountain',
'transport' => 'bus',
],
],
'03.10.2025' => [
],
[
'day' => '2025-10-03',
'activities' => [
[
'time' => '12:00',
'title' => 'Myhmanhanada çykmak',
'description' => '',
'description' => null,
'iconSet' => 'FontAwesome',
'iconName' => 'hotel',
'transport' => 'bus',
],
[
'time' => '',
'time' => null,
'title' => 'Jidda Aýraporda tarap',
'description' => '',
'description' => null,
'iconSet' => 'FontAwesome',
'iconName' => 'bus',
'transport' => 'bus',
],
],
],
];
Program::create([
'name' => 'Adaty Programma',
'group_id' => Group::first()->id,
'days' => json_encode($days),
'days' => $days,
]);
}
}