Merge branch 'dillon/110-period-lock-a' into vapor/development

This commit is contained in:
Dillon Ngo
2025-11-19 07:16:57 +08:00
39 changed files with 765 additions and 36 deletions
@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class MakeOwnerNullableInKeyValuePairs extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('key_value_pairs', function (Blueprint $table) {
$table->string('owner_type')->nullable()->change();
$table->unsignedBigInteger('owner_id')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('key_value_pairs', function (Blueprint $table) {
$table->string('owner_type')->nullable(false)->change();
$table->unsignedBigInteger('owner_id')->nullable(false)->change();
});
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace Database\Seeders;
use App\Classes\ValueObjects\Constants\KVPKey;
use Illuminate\Database\Seeder;
use App\Models\KeyValuePair;
class KeyValuePairSeeder extends Seeder
{
public function run()
{
$data = [
[
'key' => KVPKey::UI_PAYMENTS_COMPLETE_CURRENCY_ORDERS_IS_LOCKED,
'value' => 0,
],
[
'key' => KVPKey::UI_PAYMENTS_OPEN_CURRENCY_ORDERS_IS_LOCKED,
'value' => 0,
],
[
'key' => KVPKey::UI_SUPPLIER_PAID_CURRENCY_ORDER_TAB_IS_LOCKED,
'value' => 0,
],
];
foreach ($data as $item) {
KeyValuePair::updateOrCreate(
[
'owner_type' => null,
'owner_id' => null,
'key' => $item['key'],
],
[
'value' => $item['value'],
]
);
}
}
}