1
0
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:
Dan Brown
2015-07-27 20:17:08 +01:00
parent ef77c10a70
commit b9df3c647a
17 changed files with 317 additions and 40 deletions

25
app/Chapter.php Normal file
View 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;
}
}