完善功能
This commit is contained in:
43
web10/database/seeders/AdSlotSeeder.php
Normal file
43
web10/database/seeders/AdSlotSeeder.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user