refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s

This commit is contained in:
Kroonk
2026-05-22 16:19:55 +02:00
parent 38cc4c09ca
commit a213a1dba0
2215 changed files with 242567 additions and 6015 deletions

View File

@@ -0,0 +1,48 @@
<?php
use App\Models\User\User;
use App\Helpers\CountriesHelper;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DefaultTemperatureScale extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('temperature_scale')->default('celsius')->change();
});
$country = null;
$currentLocale = null;
User::orderBy('locale')->chunkById(200, function ($users) use ($country, $currentLocale) {
foreach ($users as $user) {
if ($user->locale != $currentLocale || $country == null) {
$country = CountriesHelper::getCountryFromLocale($user->locale);
$currentLocale = $user->locale;
}
if ($country !== null) {
switch ($country->getIsoAlpha2()) {
case 'US':
case 'BZ':
case 'KY':
$user->temperature_scale = 'fahrenheit';
break;
default:
$user->temperature_scale = 'celsius';
break;
}
}
$user->save();
}
});
}
}