@@ -13,6 +13,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class InterestCirclePicture extends Model
{
//
+ use SoftDeletes;
protected $table = 'interest_circle_pictures';
protected $guarded = [];
@@ -235,6 +235,12 @@ class CircleRepository
DB::beginTransaction();
try {
$circle->delete();
+ //删除图片后,判断该条是否为主信息,如果为主信息,则更新同批次下一条为主信息
+ if($circle->is_main==1){
+ $tempPic = $this->interestCirclePicture->where('patch_num', $circle->patch_num)->first();
+ $tempPic->is_main=1;
+ $tempPic->save();
+ }
DB::commit();
return Response::create();