mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-05 17:42:49 +08:00
优化分类和标签的快捷添加
This commit is contained in:
@@ -54,15 +54,17 @@ class Tag extends Common
|
||||
|
||||
$post_data = $request->post();
|
||||
|
||||
$type = $post_data['type'];
|
||||
|
||||
$arr = explode(' ',$post_data['tags']);
|
||||
|
||||
$arr = array_unique(array_filter($arr));
|
||||
|
||||
foreach ($arr as $tag) {
|
||||
$model_tag = ModelTag::where('title',$tag)->find();
|
||||
$model_tag = ModelTag::where('title',$tag)->where('type',$type)->find();
|
||||
|
||||
if(empty($model_tag)){
|
||||
ModelTag::create(['title'=>$tag]);
|
||||
ModelTag::create(['title'=>$tag,'type'=>$type]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user