| 1 | <?php |
||
| 12 | class Post extends Model |
||
| 13 | { |
||
| 14 | use PostScopes, |
||
| 15 | PostAttributes, |
||
| 16 | IsAuthorable, |
||
| 17 | PostsHaveComments, |
||
| 18 | PostsHaveACategory; |
||
| 19 | |||
| 20 | const PUBLISHED = 'published'; |
||
| 21 | const DRAFT = 'draft'; |
||
| 22 | const SCHEDULED = 'scheduled'; |
||
| 23 | |||
| 24 | protected $table = 'posts'; |
||
| 25 | |||
| 26 | protected $primaryKey = 'id'; |
||
| 27 | |||
| 28 | public $guarded = []; |
||
| 29 | |||
| 30 | public $timestamps = true; |
||
| 31 | |||
| 32 | protected $appends = ['tagsCount']; |
||
| 33 | |||
| 34 | protected $dates = ['published_at']; |
||
| 35 | |||
| 36 | public function category() |
||
| 40 | |||
| 41 | public function comments() |
||
| 45 | |||
| 46 | public function tags() |
||
| 50 | |||
| 51 | public static function boot() |
||
| 59 | |||
| 60 | public function path() |
||
| 64 | } |
||
| 65 |