示例#1
0
 public function deleteMyAddress($domain, $id, Request $request)
 {
     $userService = new userService();
     $addressService = new addressService();
     try {
         $user = $userService->getUserByEmail($this->_user->email);
         $address = $addressService->getAddressReceiveById($id);
         if (!$address || $address->user_id != $user->id || $address->default) {
             return redirect('/khach-hang/so-dia-chi');
         }
         $addressService->deleteMyAddress($user->id, $id);
         return redirect('/khach-hang/so-dia-chi');
     } catch (\Exception $e) {
         return view('errors.404', ['error_message' => $e->getMessage()]);
     }
 }