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