mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
26 lines
493 B
PHP
26 lines
493 B
PHP
<?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;
|
|
}
|
|
|
|
}
|