mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-03-26 17:19:54 +08:00
Accounted for non-existant entities
This commit is contained in:
parent
6e75bcdc37
commit
05c4b2089c
@ -95,7 +95,9 @@ class BookRepo
|
|||||||
*/
|
*/
|
||||||
public function getBySlug($slug)
|
public function getBySlug($slug)
|
||||||
{
|
{
|
||||||
return $this->book->where('slug', '=', $slug)->first();
|
$book = $this->book->where('slug', '=', $slug)->first();
|
||||||
|
if ($book === null) abort(404);
|
||||||
|
return $book;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +56,9 @@ class ChapterRepo
|
|||||||
*/
|
*/
|
||||||
public function getBySlug($slug, $bookId)
|
public function getBySlug($slug, $bookId)
|
||||||
{
|
{
|
||||||
return $this->chapter->where('slug', '=', $slug)->where('book_id', '=', $bookId)->first();
|
$chapter = $this->chapter->where('slug', '=', $slug)->where('book_id', '=', $bookId)->first();
|
||||||
|
if ($chapter === null) abort(404);
|
||||||
|
return $chapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,7 +64,9 @@ class PageRepo
|
|||||||
*/
|
*/
|
||||||
public function getBySlug($slug, $bookId)
|
public function getBySlug($slug, $bookId)
|
||||||
{
|
{
|
||||||
return $this->page->where('slug', '=', $slug)->where('book_id', '=', $bookId)->first();
|
$page = $this->page->where('slug', '=', $slug)->where('book_id', '=', $bookId)->first();
|
||||||
|
if ($page === null) abort(404);
|
||||||
|
return $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
@extends('public')
|
@extends('base')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
<h1>Page Not Found</h1>
|
<h1>Page Not Found</h1>
|
||||||
<p>The page you were looking for could not be found.</p>
|
<p>The page you were looking for could not be found.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
@stop
|
@stop
|
Loading…
x
Reference in New Issue
Block a user