<?php namespace BookStack\Entities;
use BookStack\Uploads\Attachment;
-use BookStack\Entities\Book;
-use BookStack\Entities\Chapter;
-use BookStack\Entities\Entity;
-use BookStack\Entities\PageRevision;
-class Page extends Entity
+class Page extends BookChild
{
protected $fillable = ['name', 'html', 'priority', 'markdown'];
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
$idComponent = $this->draft ? $this->id : urlencode($this->slug);
if ($path !== false) {
- return baseUrl('/books/' . urlencode($bookSlug) . $midText . $idComponent . '/' . trim($path, '/'));
+ return url('/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('/books/' . urlencode($bookSlug) . $midText . $idComponent);
}
/**