Files
lotteryLaravel/database/seeders/PlayTypeSeeder.php

80 lines
2.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
/**
* 首期玩法占位数据play_code 与 `docs/04` 玩法编码(小写)一致,便于前端/配置对齐。
*/
class PlayTypeSeeder extends Seeder
{
public function run(): void
{
$defaults = ['created_at' => now(), 'updated_at' => now()];
$rows = [
[
'play_code' => 'big',
'category' => 'standard',
'dimension' => 2,
'bet_mode' => null,
'display_name_zh' => 'Big',
'display_name_en' => 'Big',
'display_name_ne' => 'Big',
'is_enabled' => true,
'sort_order' => 10,
'supports_multi_number' => false,
'reserved_rule_json' => null,
],
[
'play_code' => 'small',
'category' => 'standard',
'dimension' => 2,
'bet_mode' => null,
'display_name_zh' => 'Small',
'display_name_en' => 'Small',
'display_name_ne' => 'Small',
'is_enabled' => true,
'sort_order' => 20,
'supports_multi_number' => false,
'reserved_rule_json' => null,
],
[
'play_code' => 'head',
'category' => 'digit',
'dimension' => 2,
'bet_mode' => null,
'display_name_zh' => 'Head',
'display_name_en' => 'Head',
'display_name_ne' => 'Head',
'is_enabled' => true,
'sort_order' => 30,
'supports_multi_number' => false,
'reserved_rule_json' => null,
],
[
'play_code' => 'tail',
'category' => 'digit',
'dimension' => 2,
'bet_mode' => null,
'display_name_zh' => 'Tail',
'display_name_en' => 'Tail',
'display_name_ne' => 'Tail',
'is_enabled' => true,
'sort_order' => 40,
'supports_multi_number' => false,
'reserved_rule_json' => null,
],
];
foreach ($rows as $row) {
DB::table('play_types')->updateOrInsert(
['play_code' => $row['play_code']],
array_merge($row, $defaults),
);
}
}
}