*/
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;
}
/**
*/
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;
}
/**
*/
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;
}
/**
-@extends('public')
+@extends('base')
@section('content')
+<div class="container">
<h1>Page Not Found</h1>
<p>The page you were looking for could not be found.</p>
+</div>
@stop
\ No newline at end of file