Files
chatroom/database/seeders/AutoFishingCardSeeder.php
T

80 lines
2.7 KiB
PHP

<?php
/**
* 文件功能:初始化自动钓鱼卡商品数据
*
* 共 3 档:2小时卡、8小时卡、24小时卡。
* 激活后钓鱼无需手动点击浮漂,系统自动收竿。
* 可重复运行(updateOrCreate 幂等)。
*/
namespace Database\Seeders;
use App\Models\ShopItem;
use Illuminate\Database\Seeder;
class AutoFishingCardSeeder extends Seeder
{
/**
* 写入 3 档自动钓鱼卡数据。
*/
public function run(): void
{
$cards = [
[
'slug' => 'auto_fishing_2h',
'name' => '自动钓鱼卡(2小时)',
'icon' => '🎣',
'description' => '激活后2小时内,钓鱼无需手动点击浮漂,系统自动收竿。',
'price' => 800,
'type' => 'auto_fishing',
'duration_minutes' => 120,
'sort_order' => 201,
'is_active' => true,
],
[
'slug' => 'auto_fishing_8h',
'name' => '自动钓鱼卡(8小时)',
'icon' => '🎣',
'description' => '激活后8小时内,钓鱼无需手动点击浮漂,系统自动收竿。超值之选!',
'price' => 2500,
'type' => 'auto_fishing',
'duration_minutes' => 480,
'sort_order' => 202,
'is_active' => true,
],
[
'slug' => 'auto_fishing_24h',
'name' => '自动钓鱼卡(24小时)',
'icon' => '🎣',
'description' => '激活后24小时内,钓鱼无需手动点击浮漂,系统自动收竿。重度钓鱼爱好者必备!',
'price' => 6000,
'type' => 'auto_fishing',
'duration_minutes' => 1440,
'sort_order' => 203,
'is_active' => true,
],
[
'slug' => 'auto_fishing_72h',
'name' => '自动钓鱼卡(72小时)',
'icon' => '🎣',
'description' => '激活后72小时内,钓鱼无需手动点击浮漂,系统自动收竿。钓鱼大神终极之选!',
'price' => 15000,
'type' => 'auto_fishing',
'duration_minutes' => 4320,
'sort_order' => 204,
'is_active' => true,
],
];
foreach ($cards as $card) {
ShopItem::updateOrCreate(
['slug' => $card['slug']],
$card
);
}
$this->command->info('✅ 3 张自动钓鱼卡已写入 shop_items。');
}
}