Skip to content

Commit 185f591

Browse files
committed
Fix version check
1 parent 17fec22 commit 185f591

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/Http/Middleware/Settings.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,13 @@ public function handle($request, Closure $next)
156156
'value' => '0',
157157
]);
158158

159-
if((int) Str::replace('.', '', config('laravel-crm.version')) >= 180) {
159+
if(Str::startsWith(config('laravel-crm.version'), '0.')) {
160+
$currentVersion = (int) Str::replace('.', '', config('laravel-crm.version'));
161+
} else {
162+
$currentVersion = (int) Str::replace('.', '', config('laravel-crm.version') * 10);
163+
}
164+
165+
if($currentVersion >= 180) {
160166
Setting::firstOrCreate([
161167
'global' => 1,
162168
'name' => 'db_update_0180',
@@ -165,7 +171,7 @@ public function handle($request, Closure $next)
165171
]);
166172
}
167173

168-
if((int) Str::replace('.', '', config('laravel-crm.version')) >= 181) {
174+
if($currentVersion >= 181) {
169175
Setting::firstOrCreate([
170176
'global' => 1,
171177
'name' => 'db_update_0181',
@@ -174,7 +180,7 @@ public function handle($request, Closure $next)
174180
]);
175181
}
176182

177-
if((int) Str::replace('.', '', config('laravel-crm.version')) >= 191) {
183+
if($currentVersion >= 191) {
178184
Setting::firstOrCreate([
179185
'global' => 1,
180186
'name' => 'db_update_0191',
@@ -183,7 +189,7 @@ public function handle($request, Closure $next)
183189
]);
184190
}
185191

186-
if((int) Str::replace('.', '', config('laravel-crm.version')) >= 193) {
192+
if($currentVersion >= 193) {
187193
Setting::firstOrCreate([
188194
'global' => 1,
189195
'name' => 'db_update_0193',
@@ -192,7 +198,7 @@ public function handle($request, Closure $next)
192198
]);
193199
}
194200

195-
if((int) Str::replace('.', '', config('laravel-crm.version')) >= 194) {
201+
if($currentVersion >= 194) {
196202
Setting::firstOrCreate([
197203
'global' => 1,
198204
'name' => 'db_update_0194',
@@ -201,7 +207,7 @@ public function handle($request, Closure $next)
201207
]);
202208
}
203209

204-
if((int) Str::replace('.', '', config('laravel-crm.version')) >= 199) {
210+
if($currentVersion >= 199) {
205211
Setting::firstOrCreate([
206212
'global' => 1,
207213
'name' => 'db_update_0199',

0 commit comments

Comments
 (0)