mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-31 15:24:31 +03:00
Refactored some core entity actions
- Created BookChild class to share some page/chapter logic. - Gave entities the power to generate their own permissions and slugs. - Moved bits out of BaseController constructor since it was overly sticky. - Moved slug generation logic into its own class. - Created a facade for permissions due to high use. - Fixed failing test issues from last commits
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
<?php namespace BookStack\Entities;
|
||||
|
||||
class Chapter extends Entity
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Chapter extends BookChild
|
||||
{
|
||||
public $searchFactor = 1.3;
|
||||
|
||||
@ -15,15 +17,6 @@ class Chapter extends Entity
|
||||
return 'BookStack\\Chapter';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the book this chapter is within.
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function book()
|
||||
{
|
||||
return $this->belongsTo(Book::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pages that this chapter contains.
|
||||
* @param string $dir
|
||||
|
Reference in New Issue
Block a user