1 | <?php |
||
17 | class Extension extends Model |
||
18 | { |
||
19 | use HasParameters; |
||
20 | const WIDGET_MENU = 1; |
||
21 | const WIDGET_WYSIWYG = 2; |
||
22 | const MENU_INTERNAL = 3; |
||
23 | const MENU_EXTERNAL = 4; |
||
24 | const MENU_ARTICLE = 5; |
||
25 | const MENU_CATEGORY_LIST = 6; |
||
26 | const MENU_CATEGORY_BLOG = 7; |
||
27 | const WIDGET_BREADCRUMB = 8; |
||
28 | const WIDGET_BLADE_VIEW = 9; |
||
29 | const WIDGET_LOGIN = 10; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $fillable = ['name', 'type', 'enabled', 'parameters']; |
||
35 | |||
36 | /** |
||
37 | * Get a widget by name. |
||
38 | * |
||
39 | * @param string $name |
||
40 | * @return $this |
||
41 | */ |
||
42 | public static function widget($name) |
||
43 | { |
||
44 | $builder = static::query(); |
||
45 | |||
46 | return $builder->where('type', 'widget') |
||
47 | ->whereRaw('LOWER(name) = ?', [Str::lower($name)]) |
||
48 | ->first(); |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Get manifest attribute. |
||
53 | * |
||
54 | * @return object |
||
55 | */ |
||
56 | public function getManifestAttribute() |
||
57 | { |
||
58 | return json_decode($this->attributes['manifest'], true); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * Get version. |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | public function getVersionAttribute() |
||
70 | |||
71 | /** |
||
72 | * Get description. |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | public function getDescriptionAttribute() |
||
80 | } |
||
81 |