Skip to content

Commit dc996ad

Browse files
committed
Merge branch 'master' into release
2 parents a64c638 + 14ea6c9 commit dc996ad

27 files changed

Lines changed: 71 additions & 18 deletions

app/Entities/Models/BookChild.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@ public function scopeWhereSlugs(Builder $query, string $bookSlug, string $childS
3131

3232
/**
3333
* Get the book this page sits in.
34-
* @return BelongsTo
3534
*/
3635
public function book(): BelongsTo
3736
{
38-
return $this->belongsTo(Book::class);
37+
return $this->belongsTo(Book::class)->withTrashed();
3938
}
4039

4140
/**

app/Entities/Models/Page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function getCurrentRevision()
121121
*/
122122
public function forJsonDisplay(): Page
123123
{
124-
$refreshed = $this->refresh()->unsetRelations()->load(['tags', 'createdBy', 'updatedBy']);
124+
$refreshed = $this->refresh()->unsetRelations()->load(['tags', 'createdBy', 'updatedBy', 'ownedBy']);
125125
$refreshed->setHidden(array_diff($refreshed->getHidden(), ['html', 'markdown']));
126126
$refreshed->html = (new PageContent($refreshed))->render();
127127
return $refreshed;

app/Http/Controllers/Api/BookApiController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function list()
3737
{
3838
$books = Book::visible();
3939
return $this->apiListingResponse($books, [
40-
'id', 'name', 'slug', 'description', 'created_at', 'updated_at', 'created_by', 'updated_by', 'image_id',
40+
'id', 'name', 'slug', 'description', 'created_at', 'updated_at', 'created_by', 'updated_by', 'owned_by', 'image_id',
4141
]);
4242
}
4343

@@ -59,7 +59,7 @@ public function create(Request $request)
5959
*/
6060
public function read(string $id)
6161
{
62-
$book = Book::visible()->with(['tags', 'cover', 'createdBy', 'updatedBy'])->findOrFail($id);
62+
$book = Book::visible()->with(['tags', 'cover', 'createdBy', 'updatedBy', 'ownedBy'])->findOrFail($id);
6363
return response()->json($book);
6464
}
6565

app/Http/Controllers/Api/BookshelfApiController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function list()
4343
{
4444
$shelves = Bookshelf::visible();
4545
return $this->apiListingResponse($shelves, [
46-
'id', 'name', 'slug', 'description', 'created_at', 'updated_at', 'created_by', 'updated_by', 'image_id',
46+
'id', 'name', 'slug', 'description', 'created_at', 'updated_at', 'created_by', 'updated_by', 'owned_by', 'image_id',
4747
]);
4848
}
4949

@@ -70,7 +70,7 @@ public function create(Request $request)
7070
public function read(string $id)
7171
{
7272
$shelf = Bookshelf::visible()->with([
73-
'tags', 'cover', 'createdBy', 'updatedBy',
73+
'tags', 'cover', 'createdBy', 'updatedBy', 'ownedBy',
7474
'books' => function (BelongsToMany $query) {
7575
$query->visible()->get(['id', 'name', 'slug']);
7676
}

app/Http/Controllers/Api/ChapterApiController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function list()
4343
$chapters = Chapter::visible();
4444
return $this->apiListingResponse($chapters, [
4545
'id', 'book_id', 'name', 'slug', 'description', 'priority',
46-
'created_at', 'updated_at', 'created_by', 'updated_by',
46+
'created_at', 'updated_at', 'created_by', 'updated_by', 'owned_by',
4747
]);
4848
}
4949

@@ -67,7 +67,7 @@ public function create(Request $request)
6767
*/
6868
public function read(string $id)
6969
{
70-
$chapter = Chapter::visible()->with(['tags', 'createdBy', 'updatedBy', 'pages' => function (HasMany $query) {
70+
$chapter = Chapter::visible()->with(['tags', 'createdBy', 'updatedBy', 'ownedBy', 'pages' => function (HasMany $query) {
7171
$query->visible()->get(['id', 'name', 'slug']);
7272
}])->findOrFail($id);
7373
return response()->json($chapter);

app/Http/Controllers/Api/PageApiController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public function list()
4747
return $this->apiListingResponse($pages, [
4848
'id', 'book_id', 'chapter_id', 'name', 'slug', 'priority',
4949
'draft', 'template',
50-
'created_at', 'updated_at', 'created_by', 'updated_by',
50+
'created_at', 'updated_at',
51+
'created_by', 'updated_by', 'owned_by',
5152
]);
5253
}
5354

dev/api/responses/books-create.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"description": "This is a book created via the API",
44
"created_by": 1,
55
"updated_by": 1,
6+
"owned_by": 1,
67
"slug": "my-new-book",
78
"updated_at": "2020-01-12 14:05:11",
89
"created_at": "2020-01-12 14:05:11",

dev/api/responses/books-list.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"updated_at": "2019-12-11 20:57:31",
1010
"created_by": 1,
1111
"updated_by": 1,
12+
"owned_by": 1,
1213
"image_id": 3
1314
},
1415
{
@@ -20,6 +21,7 @@
2021
"updated_at": "2019-12-11 20:57:23",
2122
"created_by": 4,
2223
"updated_by": 3,
24+
"owned_by": 3,
2325
"image_id": 34
2426
}
2527
],

dev/api/responses/books-read.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
"id": 1,
1414
"name": "Admin"
1515
},
16+
"owned_by": {
17+
"id": 1,
18+
"name": "Admin"
19+
},
1620
"tags": [
1721
{
1822
"id": 13,

dev/api/responses/books-update.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
"updated_at": "2020-01-12 14:16:10",
88
"created_by": 1,
99
"updated_by": 1,
10+
"owned_by": 1,
1011
"image_id": 452
1112
}

0 commit comments

Comments
 (0)