44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Database\Seeders;
|
||
|
|
|
||
|
|
use App\Models\AdSlot;
|
||
|
|
use Illuminate\Database\Seeder;
|
||
|
|
|
||
|
|
class AdSlotSeeder extends Seeder
|
||
|
|
{
|
||
|
|
public function run(): void
|
||
|
|
{
|
||
|
|
$slots = [
|
||
|
|
[
|
||
|
|
'key' => 'home',
|
||
|
|
'name' => '首页推广位',
|
||
|
|
'description' => '首页内容区推广位',
|
||
|
|
'max_items' => 3,
|
||
|
|
'sort' => 0,
|
||
|
|
],
|
||
|
|
[
|
||
|
|
'key' => 'list',
|
||
|
|
'name' => '列表页推广位',
|
||
|
|
'description' => '列表/搜索/标签页推广位',
|
||
|
|
'max_items' => 3,
|
||
|
|
'sort' => 10,
|
||
|
|
],
|
||
|
|
[
|
||
|
|
'key' => 'detail',
|
||
|
|
'name' => '详情页推广位',
|
||
|
|
'description' => '产品/文章详情页推广位',
|
||
|
|
'max_items' => 3,
|
||
|
|
'sort' => 20,
|
||
|
|
],
|
||
|
|
];
|
||
|
|
|
||
|
|
foreach ($slots as $slot) {
|
||
|
|
AdSlot::updateOrCreate(
|
||
|
|
['key' => $slot['key']],
|
||
|
|
$slot
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|