调整文章迁移

main
liutk 2024-06-19 15:40:35 +08:00
parent 20386fb4ab
commit e6ae821d4d
1 changed files with 7 additions and 1 deletions

View File

@ -26,12 +26,18 @@ class ArticleSeeder extends Seeder
]; ];
foreach($oldArticles as $article){ foreach($oldArticles as $article){
//处理富文本内容图片地址;
$_content = null;
if($article->content){
$_content = str_replace('http://www.gxflqj.cn/', 'http://www.gxflqj.cn/storage', $article->content);
}
$_article = [ $_article = [
'id' => $article -> id, 'id' => $article -> id,
'category' => $categoryArr[$article -> type ?? 0], 'category' => $categoryArr[$article -> type ?? 0],
'title' => $article->title, 'title' => $article->title,
'cover' => $article->img, 'cover' => $article->img,
'content' => $article->content, 'content' => $_content,
'published_at' => now(), 'published_at' => now(),
'sort' => $article -> sort ?? 0, 'sort' => $article -> sort ?? 0,
'is_recommend' => $article->recommend, 'is_recommend' => $article->recommend,