feat: update application settings by removing obsolete fields and adding new HR and homepage settings

This commit is contained in:
Yoga Pangestu 2026-08-13 17:42:24 +07:00
parent b905c0a2c6
commit cc227b8114
6 changed files with 20 additions and 145 deletions

View File

@ -14,8 +14,6 @@ public function up(): void
$blueprint->add('about_app', '');
$blueprint->add('email', '');
$blueprint->add('phone', '');
$blueprint->add('logo', '');
$blueprint->add('login_cover', '');
});
$this->migrator->inGroup('social_media', function (SettingsBlueprint $blueprint): void {
@ -44,5 +42,25 @@ public function up(): void
$blueprint->add('shopee_pre_order', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
$blueprint->add('shopee_live_extra', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
});
$this->migrator->inGroup('hr', function (SettingsBlueprint $blueprint): void {
$blueprint->add('scheduled_check_in_time', '08:00');
$blueprint->add('scheduled_check_out_time', '17:00');
$blueprint->add('late_penalty_amount', 0);
$blueprint->add('absent_penalty_amount', 0);
});
$this->migrator->inGroup('homepage', function (SettingsBlueprint $blueprint): void {
$blueprint->add('hero_image_url', 'https://images.unsplash.com/photo-1490481651871-ab68de25d43d?w=1000&auto=format&fit=crop&q=80');
$blueprint->add('about_image_url', 'https://images.unsplash.com/photo-1595777457583-95e059d581b8?w=800&auto=format&fit=crop&q=80');
$blueprint->add('gallery_images', [
'https://images.unsplash.com/photo-1595777457583-95e059d581b8?w=800&auto=format&fit=crop&q=80',
'https://images.unsplash.com/photo-1572804013309-59a88b7e92f1?w=800&auto=format&fit=crop&q=80',
'https://images.unsplash.com/photo-1515886657613-9f3515b0c78f?w=800&auto=format&fit=crop&q=80',
'https://images.unsplash.com/photo-1539109136881-3be0616acf4b?w=800&auto=format&fit=crop&q=80',
'https://images.unsplash.com/photo-1496747611176-843222e1e57c?w=800&auto=format&fit=crop&q=80',
'https://images.unsplash.com/photo-1509631179647-0177331693ae?w=800&auto=format&fit=crop&q=80',
]);
});
}
};

View File

@ -1,15 +0,0 @@
<?php
use Spatie\LaravelSettings\Migrations\SettingsBlueprint;
use Spatie\LaravelSettings\Migrations\SettingsMigration;
return new class extends SettingsMigration
{
public function up(): void
{
$this->migrator->inGroup('system', function (SettingsBlueprint $blueprint): void {
$blueprint->delete('logo');
$blueprint->delete('login_cover');
});
}
};

View File

@ -1,70 +0,0 @@
<?php
use App\Support\Marketplace\MarketplaceFeeRule;
use Illuminate\Support\Facades\DB;
use Spatie\LaravelSettings\Migrations\SettingsBlueprint;
use Spatie\LaravelSettings\Migrations\SettingsMigration;
return new class extends SettingsMigration
{
public function up(): void
{
$this->migrator->inGroup('marketplace', function (SettingsBlueprint $blueprint): void {
$oldKeys = [
'tiktok_shop_admin_fee',
'tiktok_shop_transaction_fee',
'tiktok_shop_payment_fee',
'tiktok_shop_affiliate_commission',
'tiktok_shop_shipping_subsidy',
'tiktok_shop_vat_rate',
'shopee_commission_fee',
'shopee_transaction_fee',
'shopee_service_fee',
'shopee_payment_fee',
'shopee_affiliate_commission',
'shopee_shipping_subsidy',
'shopee_voucher_fee',
];
$existing = DB::table('settings')
->where('group', 'marketplace')
->pluck('name')
->toArray();
foreach ($oldKeys as $key) {
if (in_array($key, $existing)) {
$blueprint->delete($key);
}
}
$newFields = [
'tiktok_shop_platform_commission',
'tiktok_shop_logistics_service_fee',
'tiktok_shop_dynamic_commission',
'tiktok_shop_order_processing_fee',
'tiktok_shop_affiliate',
'tiktok_shop_pre_order_service_fee',
'shopee_admin_fee',
'shopee_program_fee',
'shopee_shipping_savings',
'shopee_premium',
'shopee_service_fee',
'shopee_order_processing_fee',
'shopee_ams_commission_fee',
'shopee_pre_order',
'shopee_live_extra',
];
$current = DB::table('settings')
->where('group', 'marketplace')
->pluck('name')
->toArray();
foreach ($newFields as $key) {
if (! in_array($key, $current)) {
$blueprint->add($key, MarketplaceFeeRule::defaultPercent(0.0)->toArray());
}
}
});
}
};

View File

@ -1,17 +0,0 @@
<?php
use Spatie\LaravelSettings\Migrations\SettingsBlueprint;
use Spatie\LaravelSettings\Migrations\SettingsMigration;
return new class extends SettingsMigration
{
public function up(): void
{
$this->migrator->inGroup('hr', function (SettingsBlueprint $blueprint): void {
$blueprint->add('scheduled_check_in_time', '08:00');
$blueprint->add('scheduled_check_out_time', '17:00');
$blueprint->add('late_penalty_amount', 0);
$blueprint->add('absent_penalty_amount', 0);
});
}
};

View File

@ -1,23 +0,0 @@
<?php
use Spatie\LaravelSettings\Migrations\SettingsBlueprint;
use Spatie\LaravelSettings\Migrations\SettingsMigration;
return new class extends SettingsMigration
{
public function up(): void
{
$this->migrator->inGroup('homepage', function (SettingsBlueprint $blueprint): void {
$blueprint->add('hero_image_url', 'https://images.unsplash.com/photo-1490481651871-ab68de25d43d?w=1000&auto=format&fit=crop&q=80');
$blueprint->add('about_image_url', 'https://images.unsplash.com/photo-1595777457583-95e059d581b8?w=800&auto=format&fit=crop&q=80');
$blueprint->add('gallery_images', [
'https://images.unsplash.com/photo-1595777457583-95e059d581b8?w=800&auto=format&fit=crop&q=80',
'https://images.unsplash.com/photo-1572804013309-59a88b7e92f1?w=800&auto=format&fit=crop&q=80',
'https://images.unsplash.com/photo-1515886657613-9f3515b0c78f?w=800&auto=format&fit=crop&q=80',
'https://images.unsplash.com/photo-1539109136881-3be0616acf4b?w=800&auto=format&fit=crop&q=80',
'https://images.unsplash.com/photo-1496747611176-843222e1e57c?w=800&auto=format&fit=crop&q=80',
'https://images.unsplash.com/photo-1509631179647-0177331693ae?w=800&auto=format&fit=crop&q=80',
]);
});
}
};

View File

@ -1,18 +0,0 @@
<?php
use Spatie\LaravelSettings\Migrations\SettingsBlueprint;
use Spatie\LaravelSettings\Migrations\SettingsMigration;
return new class extends SettingsMigration
{
public function up(): void
{
$this->migrator->inGroup('homepage', function (SettingsBlueprint $blueprint): void {
$blueprint->delete('deal_badge');
$blueprint->delete('deal_title');
$blueprint->delete('deal_description');
$blueprint->delete('deal_cta_text');
$blueprint->delete('deal_images');
});
}
};