|
@@ -114,7 +114,20 @@ class CmsContentTemplateRepository {
|
|
|
* @param $data
|
|
|
* @return mixed
|
|
|
*/
|
|
|
- public function updateTemplateName($data){
|
|
|
+ public function updateTemplateName($data)
|
|
|
+ {
|
|
|
+ $template = $this->cmsContentTemplate->select('city_id','apply_type')->where('id',$data['id'])->first();
|
|
|
+ $template_array = $this->cmsContentTemplate->where(['city_id'=>$template->city_id,'apply_type'=>$template->apply_type])->get();
|
|
|
+
|
|
|
+ if (count($template_array)>1){
|
|
|
+ foreach ($template_array->toArray() as $value){
|
|
|
+ $res = $this->cmsContentTemplate->where('id',$value['id'])->update(['title'=>$data['title']]);
|
|
|
+ if (!$res){
|
|
|
+ throw new HttpException(500, '修改失败,请重试');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return $this->cmsContentTemplate->where('id',$data['id'])->update(['title'=>$data['title']]);
|
|
|
}
|
|
|
}
|