mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Started working on chapters
This commit is contained in:
25
app/Chapter.php
Normal file
25
app/Chapter.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php namespace Oxbow;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Chapter extends Model
|
||||
{
|
||||
|
||||
protected $fillable = ['name', 'description', 'priority', 'book_id'];
|
||||
|
||||
public function book()
|
||||
{
|
||||
return $this->belongsTo('Oxbow\Book');
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany('Oxbow\Page')->orderBy('priority', 'ASC');
|
||||
}
|
||||
|
||||
public function getUrl()
|
||||
{
|
||||
return '/books/' . $this->book->slug . '/chapter/' . $this->slug;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user