1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-11-24 03:42:32 +01:00
BookStack/app/Chapter.php

26 lines
493 B
PHP
Raw Normal View History

2015-07-27 21:17:08 +02:00
<?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;
}
}