1 | <?php namespace Arcanesoft\Blog\Models; |
||
19 | class Category extends Model |
||
20 | { |
||
21 | /* ------------------------------------------------------------------------------------------------ |
||
22 | | Traits |
||
23 | | ------------------------------------------------------------------------------------------------ |
||
24 | */ |
||
25 | use SoftDeletes; |
||
26 | |||
27 | /* ------------------------------------------------------------------------------------------------ |
||
28 | | Properties |
||
29 | | ------------------------------------------------------------------------------------------------ |
||
30 | */ |
||
31 | /** |
||
32 | * The database table used by the model |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $table = 'categories'; |
||
37 | |||
38 | /** |
||
39 | * The attributes that are mass assignable |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $fillable = ['name']; |
||
44 | |||
45 | /** |
||
46 | * Set or unset the timestamps for the model |
||
47 | * |
||
48 | * @var bool |
||
49 | */ |
||
50 | public $timestamps = true; |
||
51 | |||
52 | /** |
||
53 | * The attributes that should be mutated to dates. |
||
54 | * |
||
55 | * @var array |
||
56 | */ |
||
57 | protected $dates = ['deleted_at']; |
||
58 | |||
59 | /* ------------------------------------------------------------------------------------------------ |
||
60 | | Relationships |
||
61 | | ------------------------------------------------------------------------------------------------ |
||
62 | */ |
||
63 | /** |
||
64 | * Relationship with posts. |
||
65 | * |
||
66 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
67 | */ |
||
68 | public function posts() |
||
72 | |||
73 | /* ------------------------------------------------------------------------------------------------ |
||
74 | | Getters & Setters |
||
75 | | ------------------------------------------------------------------------------------------------ |
||
76 | */ |
||
77 | /** |
||
78 | * Set the name attribute. |
||
79 | * |
||
80 | * @param string $name |
||
81 | */ |
||
82 | public function setNameAttribute($name) |
||
87 | } |
||
88 |