1 | <?php namespace jlourenco\blog\Models; |
||
6 | class BlogPost extends Model |
||
7 | { |
||
8 | |||
9 | /** |
||
10 | * To allow user actions identity (Created_by, Updated_by, Deleted_by) |
||
11 | */ |
||
12 | use Creation; |
||
13 | |||
14 | /** |
||
15 | * {@inheritDoc} |
||
16 | */ |
||
17 | protected $table = 'BlogPost'; |
||
18 | |||
19 | /** |
||
20 | * The User model name. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected static $usersModel = 'jlourenco\base\Models\BaseUser'; |
||
25 | |||
26 | /** |
||
27 | * The Blog category model name. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected static $categoryModel = 'jlourenco\blog\Models\BlogCategory'; |
||
32 | |||
33 | /** |
||
34 | * {@inheritDoc} |
||
35 | */ |
||
36 | protected $fillable = [ |
||
37 | 'title', |
||
38 | 'contents', |
||
39 | 'category', |
||
40 | 'author', |
||
41 | 'likes', |
||
42 | 'shares', |
||
43 | 'views', |
||
44 | 'keywords' |
||
45 | ]; |
||
46 | |||
47 | /** |
||
48 | * Returns the user model. |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | public static function getUsersModel() |
||
56 | |||
57 | /** |
||
58 | * Sets the user model. |
||
59 | * |
||
60 | * @param string $usersModel |
||
61 | * @return void |
||
62 | */ |
||
63 | public static function setUsersModel($usersModel) |
||
67 | |||
68 | /** |
||
69 | * Returns the category model. |
||
70 | * |
||
71 | * @return string |
||
72 | */ |
||
73 | public static function getCategoriesModel() |
||
77 | |||
78 | /** |
||
79 | * Sets the categories model. |
||
80 | * |
||
81 | * @param string $categoryModel |
||
82 | * @return void |
||
83 | */ |
||
84 | public static function setCategoriesModel($categoryModel) |
||
88 | |||
89 | public function getAuthor() |
||
93 | |||
94 | public function getCategory() |
||
98 | |||
99 | } |
||
100 |