Skip to content

Commit 91ea990

Browse files
64knlMAPCMC
andauthored
feat: Version 0.13.6 (#168)
* fix: add nullable (#163) * feat: set null for searchitem (#166) * fix: fallback to null for SearchItem * style: formatting * fix: only add column when it doesn't exist (#167) * fix: only add column when it doesn't exist * style: formatting * fix: redirect after cms user save succes (#171) * fix: autoload policies (#172) * fix: autoload policies * chore: remove autoloading policy from service provider --------- Co-authored-by: M.A. Peene <[email protected]>
1 parent 6f2bb85 commit 91ea990

File tree

8 files changed

+21
-30
lines changed

8 files changed

+21
-30
lines changed

database/migrations/2023_10_25_171457_add_created_at_to_menu_table.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
*/
1212
public function up(): void
1313
{
14+
if (Schema::hasColumn('menu', 'created_at')) {
15+
return;
16+
}
1417
Schema::table('menu', function (Blueprint $table) {
1518
$table->timestamp('created_at')->nullable();
1619
});

src/Http/Controllers/UserManagementController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ public function update(FormDataRequest $request, CmsUser $user)
184184
$response = new LayoutResponse();
185185
if ($user->save()) {
186186
$response->addAction(new Toast(__('siteboss::response.user.updated')));
187+
$response->addAction(new Redirect('/app/users/'));
187188
} else {
188189
$response->addAction(new Toast(__('siteboss::response.user.error')));
189190
}

src/Policies/Forms/CategoryPolicy.php renamed to src/Models/Forms/Policies/CategoryPolicy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace NotFound\Framework\Policies\Forms;
3+
namespace NotFound\Framework\Models\Forms\Policies;
44

55
use NotFound\Framework\Models\CmsUser;
66
use NotFound\Framework\Models\Forms\Category;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace NotFound\Framework\Policies\Forms;
3+
namespace NotFound\Framework\Models\Forms\Policies;
44

55
use NotFound\Framework\Models\CmsUser;
66
use NotFound\Framework\Models\Forms\Data;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace NotFound\Framework\Policies\Forms;
3+
namespace NotFound\Framework\Models\Forms\Policies;
44

55
use NotFound\Framework\Models\CmsUser;
66
use NotFound\Framework\Models\Forms\Form;

src/Providers/AuthServiceProvider.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,6 @@
1111

1212
class AuthServiceProvider extends ServiceProvider
1313
{
14-
/**
15-
* The policy mappings for the application.
16-
*
17-
* @var array
18-
*/
19-
protected $policies = [
20-
'NotFound\Framework\Models\Forms\Data' => 'NotFound\Framework\Policies\Forms\DataPolicy',
21-
'NotFound\Framework\Models\Forms\Form' => 'NotFound\Framework\Policies\Forms\FormPolicy',
22-
'NotFound\Framework\Models\Forms\Category' => 'NotFound\Framework\Policies\Forms\CategoryPolicy',
23-
'NotFound\Framework\Models\Table' => 'NotFound\Framework\Policies\TablePolicy',
24-
];
25-
2614
/**
2715
* Register any authentication / authorization services.
2816
*/

src/Services/Editor/FieldsProperties.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private function addLayoutFields(array $properties, LayoutForm &$form)
150150
// $checkboxField->setValue(true);
151151
// } else {
152152
$checkboxField->setValue(false);
153-
// }
153+
// }
154154
} else {
155155
$checkboxField->setValue($value ?? false);
156156
}

src/Services/Indexer/SearchItem.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ final class SearchItem
1717

1818
private bool $inSitemap = true;
1919

20-
private ?DateTime $publicationDate;
20+
private ?DateTime $publicationDate = null;
2121

22-
private ?DateTime $lastUpdated;
22+
private ?DateTime $lastUpdated = null;
2323

2424
private int $priority = 1;
2525

@@ -146,12 +146,7 @@ public function content(): ?string
146146
*/
147147
public function publicationDate(): ?string
148148
{
149-
$time = $this->publicationDate ?? $this->lastUpdated;
150-
if ($time === null) {
151-
return null;
152-
}
153-
154-
return $time->format(DateTime::ATOM);
149+
return $this->toDateString($this->publicationDate ?? $this->lastUpdated);
155150
}
156151

157152
/**
@@ -162,12 +157,7 @@ public function publicationDate(): ?string
162157
*/
163158
public function lastUpdated(): ?string
164159
{
165-
$time = $this->lastUpdated ?? $this->publicationDate;
166-
if ($time === null) {
167-
return null;
168-
}
169-
170-
return $time->format(DateTime::ATOM);
160+
return $this->toDateString($this->lastUpdated ?? $this->publicationDate);
171161
}
172162

173163
public function customValues(): ?array
@@ -189,4 +179,13 @@ public function sitemap(): bool
189179
{
190180
return $this->inSitemap;
191181
}
182+
183+
private function toDateString(?DateTime $date): ?string
184+
{
185+
if ($date === null) {
186+
return null;
187+
}
188+
189+
return $date->format(DateTime::ATOM);
190+
}
192191
}

0 commit comments

Comments
 (0)