1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace crocodicstudio\crudbooster\Modules\SettingModule; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\Facades\DB; |
6
|
|
|
|
7
|
|
|
class Seeder |
8
|
|
|
{ |
9
|
|
|
public static function run() |
10
|
|
|
{ |
11
|
|
|
|
12
|
|
|
$data = [ |
13
|
|
|
//LOGIN REGISTER STYLE |
14
|
|
|
[ |
15
|
|
|
'name' => 'login_background_color', |
16
|
|
|
'label' => 'Login Background Color', |
17
|
|
|
'content' => null, |
18
|
|
|
'content_input_type' => 'text', |
19
|
|
|
'group_setting' => cbTrans('login_register_style'), |
20
|
|
|
'dataenum' => null, |
21
|
|
|
'helper' => 'Input hexacode', |
22
|
|
|
], |
23
|
|
|
[ |
24
|
|
|
'name' => 'login_font_color', |
25
|
|
|
'label' => 'Login Font Color', |
26
|
|
|
'content' => null, |
27
|
|
|
'content_input_type' => 'text', |
28
|
|
|
'group_setting' => cbTrans('login_register_style'), |
29
|
|
|
'dataenum' => null, |
30
|
|
|
'helper' => 'Input hexacode', |
31
|
|
|
], |
32
|
|
|
[ |
33
|
|
|
'name' => 'login_background_image', |
34
|
|
|
'label' => 'Login Background Image', |
35
|
|
|
'content' => null, |
36
|
|
|
'content_input_type' => 'upload_image', |
37
|
|
|
'group_setting' => cbTrans('login_register_style'), |
38
|
|
|
'dataenum' => null, |
39
|
|
|
'helper' => null, |
40
|
|
|
], |
41
|
|
|
|
42
|
|
|
//EMAIL SETTING |
43
|
|
|
[ |
44
|
|
|
'name' => 'email_sender', |
45
|
|
|
'label' => 'Email Sender', |
46
|
|
|
'content' => '[email protected]', |
47
|
|
|
'content_input_type' => 'text', |
48
|
|
|
'group_setting' => cbTrans('email_setting'), |
49
|
|
|
'dataenum' => null, |
50
|
|
|
'helper' => null, |
51
|
|
|
], |
52
|
|
|
[ |
53
|
|
|
'name' => 'smtp_driver', |
54
|
|
|
'label' => 'Mail Driver', |
55
|
|
|
'content' => 'mail', |
56
|
|
|
'content_input_type' => 'select', |
57
|
|
|
'group_setting' => cbTrans('email_setting'), |
58
|
|
|
'dataenum' => 'smtp,mail,sendmail', |
59
|
|
|
'helper' => null, |
60
|
|
|
], |
61
|
|
|
[ |
62
|
|
|
'name' => 'smtp_host', |
63
|
|
|
'label' => 'SMTP Host', |
64
|
|
|
'content' => '', |
65
|
|
|
'content_input_type' => 'text', |
66
|
|
|
'group_setting' => cbTrans('email_setting'), |
67
|
|
|
'dataenum' => null, |
68
|
|
|
'helper' => null, |
69
|
|
|
], |
70
|
|
|
[ |
71
|
|
|
'name' => 'smtp_port', |
72
|
|
|
'label' => 'SMTP Port', |
73
|
|
|
'content' => '25', |
74
|
|
|
'content_input_type' => 'text', |
75
|
|
|
'group_setting' => cbTrans('email_setting'), |
76
|
|
|
'dataenum' => null, |
77
|
|
|
'helper' => 'default 25', |
78
|
|
|
], |
79
|
|
|
[ |
80
|
|
|
'name' => 'smtp_username', |
81
|
|
|
'label' => 'SMTP Username', |
82
|
|
|
'content' => '', |
83
|
|
|
'content_input_type' => 'text', |
84
|
|
|
'group_setting' => cbTrans('email_setting'), |
85
|
|
|
'dataenum' => null, |
86
|
|
|
'helper' => null, |
87
|
|
|
], |
88
|
|
|
[ |
89
|
|
|
'name' => 'smtp_password', |
90
|
|
|
'label' => 'SMTP Password', |
91
|
|
|
'content' => '', |
92
|
|
|
'content_input_type' => 'text', |
93
|
|
|
'group_setting' => cbTrans('email_setting'), |
94
|
|
|
'dataenum' => null, |
95
|
|
|
'helper' => null, |
96
|
|
|
], |
97
|
|
|
|
98
|
|
|
//APPLICATION SETTING |
99
|
|
|
[ |
100
|
|
|
'name' => 'appname', |
101
|
|
|
'label' => 'Application Name', |
102
|
|
|
'group_setting' => cbTrans('application_setting'), |
103
|
|
|
'content' => 'CRUDBooster', |
104
|
|
|
'content_input_type' => 'text', |
105
|
|
|
'dataenum' => null, |
106
|
|
|
'helper' => null, |
107
|
|
|
], |
108
|
|
|
[ |
109
|
|
|
'name' => 'default_paper_size', |
110
|
|
|
'label' => 'Default Paper Print Size', |
111
|
|
|
'group_setting' => cbTrans('application_setting'), |
112
|
|
|
'content' => 'Legal', |
113
|
|
|
'content_input_type' => 'text', |
114
|
|
|
'dataenum' => null, |
115
|
|
|
'helper' => 'Paper size, ex : A4, Legal, etc', |
116
|
|
|
], |
117
|
|
|
[ |
118
|
|
|
'name' => 'logo', |
119
|
|
|
'label' => 'Logo', |
120
|
|
|
'content' => '', |
121
|
|
|
'content_input_type' => 'upload_image', |
122
|
|
|
'group_setting' => cbTrans('application_setting'), |
123
|
|
|
'dataenum' => null, |
124
|
|
|
'helper' => null, |
125
|
|
|
], |
126
|
|
|
[ |
127
|
|
|
'name' => 'favicon', |
128
|
|
|
'label' => 'Favicon', |
129
|
|
|
'content' => '', |
130
|
|
|
'content_input_type' => 'upload_image', |
131
|
|
|
'group_setting' => cbTrans('application_setting'), |
132
|
|
|
'dataenum' => null, |
133
|
|
|
'helper' => null, |
134
|
|
|
], |
135
|
|
|
[ |
136
|
|
|
'name' => 'api_debug_mode', |
137
|
|
|
'label' => 'API Debug Mode', |
138
|
|
|
'content' => 'true', |
139
|
|
|
'content_input_type' => 'select', |
140
|
|
|
'group_setting' => cbTrans('application_setting'), |
141
|
|
|
'dataenum' => 'true,false', |
142
|
|
|
'helper' => null, |
143
|
|
|
], |
144
|
|
|
[ |
145
|
|
|
|
146
|
|
|
'name' => 'google_api_key', |
147
|
|
|
'label' => 'Google API Key', |
148
|
|
|
'content' => '', |
149
|
|
|
'content_input_type' => 'text', |
150
|
|
|
'group_setting' => cbTrans('application_setting'), |
151
|
|
|
'dataenum' => null, |
152
|
|
|
'helper' => null, |
153
|
|
|
], |
154
|
|
|
[ |
155
|
|
|
|
156
|
|
|
'name' => 'google_fcm_key', |
157
|
|
|
'label' => 'Google FCM Key', |
158
|
|
|
'content' => '', |
159
|
|
|
'content_input_type' => 'text', |
160
|
|
|
'group_setting' => cbTrans('application_setting'), |
161
|
|
|
'dataenum' => null, |
162
|
|
|
'helper' => null, |
163
|
|
|
], |
164
|
|
|
]; |
165
|
|
|
|
166
|
|
|
foreach ($data as $row) { |
167
|
|
|
$count = DB::table('cms_settings')->where('name', $row['name'])->count(); |
168
|
|
|
if (! $count) { |
169
|
|
|
DB::table('cms_settings')->insert($row); |
170
|
|
|
continue; |
171
|
|
|
} |
172
|
|
|
if ($count > 1) { |
173
|
|
|
$newsId = DB::table('cms_settings')->where('name', $row['name'])->orderby('id', 'asc')->take(1)->first(); |
174
|
|
|
DB::table('cms_settings')->where('name', $row['name'])->where('id', '!=', $newsId->id)->delete(); |
175
|
|
|
} |
176
|
|
|
} |
177
|
|
|
} |
178
|
|
|
} |