File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ public function rules(): array
1414 return [
1515 '*.title ' => 'required|string|max:512 ' ,
1616 '*.content ' => 'required|string ' ,
17- '*.description ' => 'sometimes |string ' ,
17+ // '*.description' => 'nullable |string',
1818 '*.category_id ' => 'required|integer|exists:blog_categories,id ' ,
1919 '*.seo_meta_title ' => 'nullable|string|max:512 ' ,
2020 '*.seo_meta_keywords ' => 'nullable|string|max:512 ' ,
@@ -27,6 +27,8 @@ public function model(array $row)
2727 {
2828 $ blogController = new BlogController ();
2929 $ row ['cover_image ' ] = $ blogController ->extractFirstImageFromContent ($ row ['content ' ]);
30+ // desc from content 截取200个字符
31+ $ row ['description ' ] = mb_substr ($ row ['content ' ], 0 , 200 );
3032 $ row ['created_at ' ] = date ('Y-m-d H:i:s ' );
3133 $ row ['updated_at ' ] = date ('Y-m-d H:i:s ' );
3234
You can’t perform that action at this time.
0 commit comments