Upgrade to 3.1.0

This commit is contained in:
Bastian Allgeier
2019-03-19 11:07:14 +01:00
parent 418db4b09b
commit 6e074142f1
98 changed files with 1266 additions and 299 deletions

View File

@@ -28,7 +28,9 @@ class PageRules
if ($page->permissions()->changeSlug() !== true) {
throw new PermissionException([
'key' => 'page.changeSlug.permission',
'data' => ['slug' => $page->slug()]
'data' => [
'slug' => $page->slug()
]
]);
}
@@ -39,7 +41,9 @@ class PageRules
if ($duplicate->is($page) === false) {
throw new DuplicateException([
'key' => 'page.duplicate',
'data' => ['slug' => $slug]
'data' => [
'slug' => $slug
]
]);
}
}
@@ -48,7 +52,9 @@ class PageRules
if ($duplicate->is($page) === false) {
throw new DuplicateException([
'key' => 'page.draft.duplicate',
'data' => ['slug' => $slug]
'data' => [
'slug' => $slug
]
]);
}
}
@@ -79,14 +85,18 @@ class PageRules
if ($page->permissions()->changeStatus() !== true) {
throw new PermissionException([
'key' => 'page.changeStatus.permission',
'data' => ['slug' => $page->slug()]
'data' => [
'slug' => $page->slug()
]
]);
}
if ($page->isHomeOrErrorPage() === true) {
throw new PermissionException([
'key' => 'page.changeStatus.toDraft.invalid',
'data' => ['slug' => $page->slug()]
'data' => [
'slug' => $page->slug()
]
]);
}
@@ -101,7 +111,9 @@ class PageRules
if ($page->isSortable() !== true) {
throw new PermissionException([
'key' => 'page.sort.permission',
'data' => ['slug' => $page->slug()]
'data' => [
'slug' => $page->slug()
]
]);
}
@@ -111,7 +123,9 @@ class PageRules
if ($page->permissions()->changeStatus() !== true) {
throw new PermissionException([
'key' => 'page.changeStatus.permission',
'data' => ['slug' => $page->slug()]
'data' => [
'slug' => $page->slug()
]
]);
}
@@ -134,7 +148,9 @@ class PageRules
if ($page->permissions()->changeStatus() !== true) {
throw new PermissionException([
'key' => 'page.changeStatus.permission',
'data' => ['slug' => $page->slug()]
'data' => [
'slug' => $page->slug()
]
]);
}
@@ -146,7 +162,9 @@ class PageRules
if ($page->permissions()->changeTemplate() !== true) {
throw new PermissionException([
'key' => 'page.changeTemplate.permission',
'data' => ['slug' => $page->slug()]
'data' => [
'slug' => $page->slug()
]
]);
}
@@ -171,7 +189,9 @@ class PageRules
if ($page->permissions()->changeTitle() !== true) {
throw new PermissionException([
'key' => 'page.changeTitle.permission',
'data' => ['slug' => $page->slug()]
'data' => [
'slug' => $page->slug()
]
]);
}
@@ -183,12 +203,19 @@ class PageRules
if ($page->exists() === true) {
throw new DuplicateException([
'key' => 'page.draft.duplicate',
'data' => ['slug' => $page->slug()]
'data' => [
'slug' => $page->slug()
]
]);
}
if ($page->permissions()->create() !== true) {
throw new PermissionException(['key' => 'page.create.permission']);
throw new PermissionException([
'key' => 'page.create.permission',
'data' => [
'slug' => $page->slug()
]
]);
}
$siblings = $page->parentModel()->children();
@@ -215,7 +242,12 @@ class PageRules
public static function delete(Page $page, bool $force = false): bool
{
if ($page->permissions()->delete() !== true) {
throw new PermissionException(['key' => 'page.delete.permission']);
throw new PermissionException([
'key' => 'page.delete.permission',
'data' => [
'slug' => $page->slug()
]
]);
}
if (($page->hasChildren() === true || $page->hasDrafts() === true) && $force === false) {