vendredi 13 juillet 2018

How to get only one resposnse using try catch ( using laravel 5)

Hi I am facing very serious issue and i am stuck here i want to get only one response from email i am getting i have Pending and Booked field.

Response i am getting is:

   We have received your reservation request for Creede Haven River Cabin. 
        Details below:<br />
              <br />
              Guest Name: Shahzad Shah<br />
        Arrival: 14/7/2018 Departure: 15/7/2018 Number of nights: 1<br />
           Number of guests: Adults 2 Children 3<br />
       Pets 0<br />
       <br />
       <br />
      <br />
    Total: $702.00 <p>Pending Reservation</p>

     </body>
      </html> 

and second one is :

                           Hi Shahzad,<br />
              <br />
              We are pleased to CONFIRM your reservation at Creede Haven 
             River Cabin.  Details of your reservation are below:<br />
               <br />
                Guest Name:  Shahzad Shah<br />
           Arrival:  14/7/2018 Departure: 15/7/2018 Number of nights:  1<br 
                   />
           Number of guests:  Adults 2 Children 3<br />
           Pets 0<br />
         <br />
       Total: $702.00 <p>Booked Reservation</p>

         </body>
         </html>  

The problem is here i am getting here two response if i select Booked from drop down i want to display on Booked Reservation but here is displaying both

and if i select pending from drop down here should display Pending Reservation but here is i am getting both:

My Code: for admin

                   try {
        // send email to admin
        if ($reservation->property->is_an_owner_reservation != 1) {
            EmailController::sendAdminEmail($reservation);
        }
    } catch (Exception $e) {
        Log::info('sendAdminEmail dont work');
        Log::info($e);
    }

    try {
        // send email to admin pending
        if ($reservation->property->is_an_owner_reservation != 1) {
            EmailController::sendCustomerEmailPending($reservation);
        }
    } catch (Exception $e) {
        Log::info('sendAdminEmail dont work');
        Log::info($e);
    }

and for customer:

                       try {
                if ($reservation->is_an_owner_reservation != 1) // this is a customer reservation
                {
                    EmailController::sendCustomerEmail($reservation);
                }
            } catch (Exception $e) {
                Log::info('sendCustomerEmail dont work');
                Log::info($e);
            }
            try {
                if ($reservation->is_an_owner_reservation != 1) // this is a customer reservation
                {
                    EmailController::sendCustomerEmailPending($reservation);
                }
            } catch (Exception $e) {
                Log::info('sendCustomerEmail dont work');
                Log::info($e);
            }

where i am doing wrong Your help will be highly appreciated and i need this help!

Aucun commentaire:

Enregistrer un commentaire