From 7e40f535cd7c30c3921a7d519c416a3774a6151c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= Date: Fri, 17 Nov 2023 13:45:03 +0100 Subject: [PATCH 1/4] fix: add nullable (#163) --- .../2023_10_25_171457_add_created_at_to_menu_table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2023_10_25_171457_add_created_at_to_menu_table.php b/database/migrations/2023_10_25_171457_add_created_at_to_menu_table.php index c5c9f83b..3556e367 100644 --- a/database/migrations/2023_10_25_171457_add_created_at_to_menu_table.php +++ b/database/migrations/2023_10_25_171457_add_created_at_to_menu_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::table('menu', function (Blueprint $table) { - $table->timestamp('created_at'); + $table->timestamp('created_at')->nullable(); }); } From b12e50265ddc23cf5bda4d1d0e651b9096bee36c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= Date: Wed, 22 Nov 2023 14:32:25 +0100 Subject: [PATCH 2/4] feat: set null for searchitem (#166) * fix: fallback to null for SearchItem * style: formatting --- src/Services/Indexer/SearchItem.php | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/Services/Indexer/SearchItem.php b/src/Services/Indexer/SearchItem.php index 38b70e2d..52cd12ca 100644 --- a/src/Services/Indexer/SearchItem.php +++ b/src/Services/Indexer/SearchItem.php @@ -17,9 +17,9 @@ final class SearchItem private bool $inSitemap = true; - private ?DateTime $publicationDate; + private ?DateTime $publicationDate = null; - private ?DateTime $lastUpdated; + private ?DateTime $lastUpdated = null; private int $priority = 1; @@ -146,12 +146,7 @@ public function content(): ?string */ public function publicationDate(): ?string { - $time = $this->publicationDate ?? $this->lastUpdated; - if ($time === null) { - return null; - } - - return $time->format(DateTime::ATOM); + return $this->toDateString($this->publicationDate ?? $this->lastUpdated); } /** @@ -162,12 +157,7 @@ public function publicationDate(): ?string */ public function lastUpdated(): ?string { - $time = $this->lastUpdated ?? $this->publicationDate; - if ($time === null) { - return null; - } - - return $time->format(DateTime::ATOM); + return $this->toDateString($this->lastUpdated ?? $this->publicationDate); } public function customValues(): ?array @@ -189,4 +179,13 @@ public function sitemap(): bool { return $this->inSitemap; } + + private function toDateString(?DateTime $date): ?string + { + if ($date === null) { + return null; + } + + return $date->format(DateTime::ATOM); + } } From 5e6a9b28cc2691d89abfb7bea058d709ce001450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= Date: Wed, 22 Nov 2023 23:28:30 +0100 Subject: [PATCH 3/4] fix: only add column when it doesn't exist (#167) * fix: only add column when it doesn't exist * style: formatting --- .../2023_10_25_171457_add_created_at_to_menu_table.php | 3 +++ src/Services/Editor/FieldsProperties.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/database/migrations/2023_10_25_171457_add_created_at_to_menu_table.php b/database/migrations/2023_10_25_171457_add_created_at_to_menu_table.php index 3556e367..c7fc39fe 100644 --- a/database/migrations/2023_10_25_171457_add_created_at_to_menu_table.php +++ b/database/migrations/2023_10_25_171457_add_created_at_to_menu_table.php @@ -11,6 +11,9 @@ */ public function up(): void { + if (Schema::hasColumn('menu', 'created_at')) { + return; + } Schema::table('menu', function (Blueprint $table) { $table->timestamp('created_at')->nullable(); }); diff --git a/src/Services/Editor/FieldsProperties.php b/src/Services/Editor/FieldsProperties.php index 806dfc4e..b2967609 100644 --- a/src/Services/Editor/FieldsProperties.php +++ b/src/Services/Editor/FieldsProperties.php @@ -150,7 +150,7 @@ private function addLayoutFields(array $properties, LayoutForm &$form) // $checkboxField->setValue(true); // } else { $checkboxField->setValue(false); - // } + // } } else { $checkboxField->setValue($value ?? false); } From f2750152c0785cd417e43831782da424cb65ec43 Mon Sep 17 00:00:00 2001 From: Rene Date: Wed, 15 Nov 2023 15:59:15 +0100 Subject: [PATCH 4/4] feat: add config --- config/forwards.php | 19 +++++++++++++++++++ src/FrameworkServiceProvider.php | 1 + 2 files changed, 20 insertions(+) create mode 100644 config/forwards.php diff --git a/config/forwards.php b/config/forwards.php new file mode 100644 index 00000000..579900e3 --- /dev/null +++ b/config/forwards.php @@ -0,0 +1,19 @@ + env('SITEBOSS_FORWARDS_TOKEN'), +]; diff --git a/src/FrameworkServiceProvider.php b/src/FrameworkServiceProvider.php index 91925468..a5759758 100644 --- a/src/FrameworkServiceProvider.php +++ b/src/FrameworkServiceProvider.php @@ -33,6 +33,7 @@ public function boot(): void __DIR__.'/../config/openid.php' => config_path('openid.php'), __DIR__.'/../config/clamav.php' => config_path('clamav.php'), __DIR__.'/../config/database.php' => config_path('database.php'), + __DIR__.'/../config/forwards.php' => config_path('forwards.php'), __DIR__.'/../config/indexer.php' => config_path('indexer.php'), __DIR__.'/../config/laravellocalization.php' => config_path('laravellocalization.php'), __DIR__.'/Providers/AuthServiceProvider.php' => app_path('Providers/AuthServiceProvider.php'),