/**
* 删除信用卡
* @param Request $request
* @return array|\Illuminate\Http\JsonResponse
* @throws \App\Exceptions\CustomException
*/
public function modifyCreditCardImg(Request $request)
{
$valid = Validator::make($request->all(), [
'id' => 'required|string|size:36'
]);
if ($valid->fails()) {
return array(
'code' => ExceptionErrorCode::CODEMUST,
'message' => $valid->errors()->first(),
'data' => $valid->errors()->first()
);
}
$credit_card = CreditCardImages::where(['id' => $request->id])->get()->first();
Storage::delete(str_replace('storage', 'public', $credit_card->image_positive));
Storage::delete(str_replace('storage', 'public', $credit_card->image_back));
CreditCardImages::where(['id' => $request->id])->delete();
return responseMessage([], ExceptionErrorCode::OPERATOR_OK);
}