Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Зуев Егор
/
wiki.dev
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Authored by
Dan Brown
2015-07-30 23:18:48 +0100
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
b506beac647e384caff59740a21301420b9ec33b
b506beac
1 parent
1e2f5ded
Fix for getting book items
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
app/Book.php
app/Repos/BookRepo.php
app/Book.php
View file @
b506bea
...
...
@@ -33,8 +33,10 @@ class Book extends Model
{
$pages
=
$this
->
pages
()
->
where
(
'chapter_id'
,
'='
,
0
)
->
get
();
$chapters
=
$this
->
chapters
()
->
get
();
$children
=
$pages
->
merge
(
$chapters
);
return
$children
->
sortBy
(
'priority'
);
foreach
(
$chapters
as
$chapter
)
{
$pages
->
push
(
$chapter
);
}
return
$pages
->
sortBy
(
'priority'
);
}
}
...
...
app/Repos/BookRepo.php
View file @
b506bea
...
...
@@ -47,8 +47,11 @@ class BookRepo
public
function
destroyBySlug
(
$bookSlug
)
{
$book
=
$this
->
getBySlug
(
$bookSlug
);
foreach
(
$book
->
children
()
as
$child
)
{
$child
->
delete
();
foreach
(
$book
->
pages
as
$page
)
{
$page
->
delete
();
}
foreach
(
$book
->
chapters
as
$chapter
)
{
$chapter
->
delete
();
}
$book
->
delete
();
}
...
...
Please
register
or
sign in
to post a comment