public $textField = 'text';
- protected $hidden = ['html', 'markdown', 'text', 'restricted', 'pivot', 'deleted_at'];
+ protected $hidden = ['html', 'markdown', 'text', 'pivot', 'deleted_at'];
protected $casts = [
'draft' => 'boolean',
/**
* Get the current revision for the page if existing.
- *
- * @return PageRevision|null
*/
public function currentRevision(): HasOne
{
return $refreshed;
}
+
+ /**
+ * Get a visible page by its book and page slugs.
+ * @throws \Illuminate\Database\Eloquent\ModelNotFoundException
+ */
+ public static function getBySlugs(string $bookSlug, string $pageSlug): self
+ {
+ return static::visible()->whereSlugs($bookSlug, $pageSlug)->firstOrFail();
+ }
}