| Total Complexity | 2 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 6 | class Category extends Model |
||
| 7 | { |
||
| 8 | use CategoryPresenter; |
||
|
|
|||
| 9 | |||
| 10 | /** |
||
| 11 | * The attributes that are mass assignable. |
||
| 12 | * |
||
| 13 | * @var array |
||
| 14 | */ |
||
| 15 | protected $fillable = [ |
||
| 16 | 'title', |
||
| 17 | 'slug', |
||
| 18 | 'description' |
||
| 19 | ]; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * The accessors to append to the model's array form. |
||
| 23 | * |
||
| 24 | * @var array |
||
| 25 | */ |
||
| 26 | protected $appends = [ |
||
| 27 | 'category_url' |
||
| 28 | ]; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Return the field to slug. |
||
| 32 | * |
||
| 33 | * @return string |
||
| 34 | */ |
||
| 35 | public function slugStrategy(): string |
||
| 36 | { |
||
| 37 | return 'title'; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Get the articles for the category. |
||
| 42 | * |
||
| 43 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
| 44 | */ |
||
| 45 | public function articles() |
||
| 48 | } |
||
| 49 | } |
||
| 50 |