You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
|
2 weeks ago
|
<?php
|
||
|
|
|
||
|
|
namespace Database\Seeders;
|
||
|
|
|
||
|
|
use App\Models\DictItem;
|
||
|
|
use App\Models\DictType;
|
||
|
|
use Illuminate\Database\Seeder;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 活动类型下拉:沙龙 / 讲座 / 论坛(与 prototype activity-create.html 一致)。
|
||
|
|
*/
|
||
|
|
class ActivityDictionarySeeder extends Seeder
|
||
|
|
{
|
||
|
|
public function run(): void
|
||
|
|
{
|
||
|
|
$type = DictType::query()->updateOrCreate(
|
||
|
|
['code' => 'activity_type'],
|
||
|
|
[
|
||
|
|
'name' => '活动类型',
|
||
|
|
'remark' => '活动管理-类型下拉;沙龙/讲座/论坛',
|
||
|
|
'status' => 1,
|
||
|
|
'sort' => 50,
|
||
|
|
]
|
||
|
|
);
|
||
|
|
|
||
|
|
foreach ([
|
||
|
|
['label' => '沙龙', 'value' => 'salon', 'sort' => 10],
|
||
|
|
['label' => '讲座', 'value' => 'lecture', 'sort' => 20],
|
||
|
|
['label' => '论坛', 'value' => 'forum', 'sort' => 30],
|
||
|
|
] as $row) {
|
||
|
|
DictItem::query()->updateOrCreate(
|
||
|
|
['dict_type_id' => $type->id, 'value' => $row['value']],
|
||
|
|
['label' => $row['label'], 'sort' => $row['sort'], 'status' => 1]
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|