1 | <?php |
||
11 | class Article extends ChocolateyModel |
||
12 | { |
||
13 | use Eloquence, Mappable; |
||
14 | |||
15 | /** |
||
16 | * The table associated with the model. |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $table = 'chocolatey_articles'; |
||
21 | |||
22 | /** |
||
23 | * Primary Key of the Table. |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $primaryKey = 'id'; |
||
28 | |||
29 | /** |
||
30 | * The attributes that will be mapped. |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $maps = ['updatedAt' => 'updated_at', 'createdAt' => 'created_at']; |
||
35 | |||
36 | /** |
||
37 | * The Appender(s) of the Model. |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | protected $appends = ['updatedAt', 'createdAt']; |
||
42 | |||
43 | /** |
||
44 | * The attributes excluded from the model's JSON form. |
||
45 | * |
||
46 | * @var array |
||
47 | */ |
||
48 | protected $hidden = ['updated_at', 'created_at']; |
||
49 | |||
50 | /** |
||
51 | * Store a new CMS Article. |
||
52 | * |
||
53 | * @param string $title |
||
54 | * @param string $description |
||
55 | * @param string $content |
||
56 | * @param string $author |
||
57 | * @param string $categories |
||
58 | * @param string $imageUrl |
||
59 | * @param string $thumbnailUrl |
||
60 | * |
||
61 | * @return Article |
||
62 | */ |
||
63 | public function store(string $title, string $description, string $content, string $author, string $categories, string $imageUrl, string $thumbnailUrl): Article |
||
77 | |||
78 | /** |
||
79 | * Get All Article Categories from the Article. |
||
80 | * |
||
81 | * @return array |
||
82 | */ |
||
83 | public function getCategoriesAttribute(): array |
||
93 | } |
||
94 |