Files
cloud-chip.cn/database/seeders/ArticleSeeder.php
T
2026-08-08 18:27:38 +08:00

43 lines
2.4 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 App\Models\Article;
use App\Models\Category;
use Illuminate\Database\Seeder;
class ArticleSeeder extends Seeder
{
public function run(): void
{
$cat = Category::where('slug', 'design-guide')->first();
$items = [
[
'category_id' => $cat?->id,
'title' => '多口 PD 充电器设计要点:端口优先级与功率分配策略',
'slug' => 'multi-port-pd-design-guide',
'summary' => '本文介绍多口 PD 充电器中端口优先级判定、动态功率分配和热管理的设计要点。',
'body' => "## 端口优先级\n\n多口 PD 充电器需要根据接入设备类型和数量动态分配功率。常见策略包括:\n\n1. **均分策略**:各口平均分配总功率\n2. **优先级策略**:C1 口优先获得最大功率\n3. **自适应策略**:根据设备请求的 PD contract 动态调整\n\n## 功率分配\n\n以 CC-PD3168 为例,3 口总功率 100W\n- 单口接入时:C1/C2/C3 均可输出 100W (20V/5A)\n- 双口接入时:C1=65W, C2=30W\n- 三口接入时:C1=65W, C2=20W, C3=15W\n\n## 热管理\n\n多口同时工作时热量集中,需要合理的 PCB 布局和散热设计。",
'author' => '云创芯技术团队',
'status' => 'published',
'published_at' => now()->subDays(7),
],
[
'category_id' => $cat?->id,
'title' => 'USB PD3.X 协议解析:PPS 与 SPRS 模式',
'slug' => 'usb-pd3-pps-sprs-explained',
'summary' => '深入解析 USB PD3.X 中的 PPS(可编程电源)和 SPRS(系统电源参考)模式。',
'body' => "## PPS 模式\n\nPPSProgrammable Power Supply)允许电源在 3.3V 到 21V 之间以 20mV 步进调整输出电压,实现更精细的电压匹配。\n\n## SPRS 模式\n\nSPRSSystem Power Reference)是 PD3.X 中新增的参考电压机制,用于多设备系统级电源管理。\n\n## 应用场景\n\n- 笔记本快充:PPS 可降低转换损耗约 5%\n- 移动电源:SPRS 简化多设备充电管理",
'author' => '云创芯技术团队',
'status' => 'published',
'published_at' => now()->subDays(3),
],
];
foreach ($items as $item) {
Article::firstOrCreate(['slug' => $item['slug']], $item);
}
}
}