mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-24 03:42:32 +01: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;
|
|
}
|
|
|
|
}
|