X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/257a5a23ecaf7ce779969d575ff8a0b976181d13..refs/pull/1688/head:/app/Entities/Page.php diff --git a/app/Entities/Page.php b/app/Entities/Page.php index ea7df16f4..752b3c9dd 100644 --- a/app/Entities/Page.php +++ b/app/Entities/Page.php @@ -2,7 +2,7 @@ use BookStack\Uploads\Attachment; -class Page extends Entity +class Page extends BookChild { protected $fillable = ['name', 'html', 'priority', 'markdown']; @@ -30,15 +30,6 @@ class Page extends Entity return $array; } - /** - * Get the book this page sits in. - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function book() - { - return $this->belongsTo(Book::class); - } - /** * Get the parent item * @return \Illuminate\Database\Eloquent\Relations\BelongsTo @@ -96,21 +87,10 @@ class Page extends Entity $idComponent = $this->draft ? $this->id : urlencode($this->slug); if ($path !== false) { - return baseUrl('/books/' . urlencode($bookSlug) . $midText . $idComponent . '/' . trim($path, '/')); + return url('/http/source.bookstackapp.com/books/' . urlencode($bookSlug) . $midText . $idComponent . '/' . trim($path, '/')); } - return baseUrl('/books/' . urlencode($bookSlug) . $midText . $idComponent); - } - - /** - * Get an excerpt of this page's content to the specified length. - * @param int $length - * @return mixed - */ - public function getExcerpt($length = 100) - { - $text = strlen($this->text) > $length ? substr($this->text, 0, $length-3) . '...' : $this->text; - return mb_convert_encoding($text, 'UTF-8'); + return url('/http/source.bookstackapp.com/books/' . urlencode($bookSlug) . $midText . $idComponent); } /**