Commit d69560b6 by 杨昕

sfd

parent a115fbe6
...@@ -48,19 +48,16 @@ class MediaCategoryModel extends Eloquent ...@@ -48,19 +48,16 @@ class MediaCategoryModel extends Eloquent
'status' => 0 'status' => 0
]; ];
$mediaCatg = DB::connection("mongodb")->collection(self::$collection)->where('name',$request->name)->first(); $mediaCatg = MediaCategoryModel::where('name',$request->name)->first();
if (!empty($mediaCatg)){ if (!empty($mediaCatg)){
throw new \Exception('媒资类别已经存在'); throw new \Exception('媒资类别已经存在');
} }
$id = MediaCategoryModel::insertGetId($data);
$id = DB::connection("mongodb")->collection(self::$collection)->insertGetId($data);
}catch (\Exception $exception){ }catch (\Exception $exception){
throw new DatabaseException("组织不存在"); throw new DatabaseException("组织不存在");
} }
return $id; return $id;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment