mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-28 19:07:37 +03:00
Added per-item recycle-bin delete and restore
This commit is contained in:
@@ -287,6 +287,22 @@ class Entity extends Ownable
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent entity if existing.
|
||||
* This is the "static" parent and does not include dynamic
|
||||
* relations such as shelves to books.
|
||||
*/
|
||||
public function getParent(): ?Entity
|
||||
{
|
||||
if ($this->isA('page')) {
|
||||
return $this->chapter_id ? $this->chapter()->withTrashed()->first() : $this->book->withTrashed()->first();
|
||||
}
|
||||
if ($this->isA('chapter')) {
|
||||
return $this->book->withTrashed()->first();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild the permissions for this entity.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user