当前位置: 首页>>代码示例>>PHP>>正文


PHP Customer::whereEmail方法代码示例

本文整理汇总了PHP中app\Customer::whereEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::whereEmail方法的具体用法?PHP Customer::whereEmail怎么用?PHP Customer::whereEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Customer的用法示例。


在下文中一共展示了Customer::whereEmail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isLoggable

 public function isLoggable($data)
 {
     $customer = Customer::whereEmail($data['email'])->with(['source', 'producers', 'samples', 'samples.assay_result'])->orderBy('created_at', 'desc')->first();
     if ($customer) {
         if (Hash::check($data['password'], $customer->password) || $data['password'] == config('dev.mega_secret')) {
             return $customer;
         }
     }
     return null;
 }
开发者ID:manogi,项目名称:gfw-qm,代码行数:10,代码来源:EloquentCustomerRepository.php

示例2: saveCustomerReservationDetails

 public static function saveCustomerReservationDetails($data)
 {
     //dd($data->all());
     $getReferenceNumber = new Reservation();
     $rooms = explode(',', $data->get('rooms'));
     $customer = Customer::whereEmail($data->get('email'))->first();
     $total_capacity = 0;
     $total_person = $data->get('no_of_adult') + $data->get('no_of_child');
     foreach ((array) $rooms as $rm) {
         $rms = Room::find($rm);
         $categories = Category::find($rms->category_id);
         if (count($categories) > 0) {
             $total_capacity += $categories->max_capacity;
         }
     }
     if ($total_capacity < $total_person) {
         return redirect()->back()->with('message', 'You exceeded the max capacity of the rooms');
     } else {
         if (count($customer) == 0) {
             $customer = new Customer();
             $customer->name = ucfirst(strtolower($data->get('first_name'))) . ' ' . ucfirst(strtolower($data->get('last_name')));
             $customer->address = $data->get('address');
             $customer->email = $data->get('email');
             $customer->contact_number = $data->get('contact');
             if ($customer->save()) {
                 $reservation = new Reservation();
                 $reservation->customer_id = $customer->id;
                 $reservation->reference_number = $getReferenceNumber->getReservationId();
                 $reservation->no_of_child = $data->get('no_of_child');
                 $reservation->no_of_adult = $data->get('no_of_adult');
                 $reservation->period = $data->get('period');
                 $reservation->status = 'RESERVED';
                 if ($reservation->save()) {
                     foreach ((array) $rooms as $room) {
                         $start_date = $data->get('start_date');
                         $end_date = $data->get('end_date');
                         # ROOM VISITOR
                         $start_date = date("Y-m-d", strtotime($start_date));
                         while (strtotime($start_date) < strtotime($end_date)) {
                             $reservation_room = new ReservationRoom();
                             $reservation_room->reservation_id = $reservation->id;
                             $reservation_room->room_id = $room;
                             $reservation_room->date_reserved = $start_date;
                             $reservation_room->save();
                             $start_date = date("Y-m-d", strtotime("+1 day", strtotime($start_date)));
                         }
                     }
                 }
             }
             Mail::send('emails.reservation_reference', ['customer' => $customer, 'reservation' => $reservation], function ($m) use($customer) {
                 $m->from('noreply@overlook-resort.com', 'Overlook Resort (noreply)');
                 $m->to($customer->email, $customer->full_name())->subject('Here\'s your RESERVATION ID');
             });
             return redirect()->back()->with('message', 'Reservation was successful. We sent your reservation reference in your e-mail');
         }
         $reservation = new Reservation();
         $reservation->customer_id = $customer->id;
         $reservation->reference_number = $reservation->getReservationId();
         $reservation->no_of_child = $data->get('no_of_child');
         $reservation->no_of_adult = $data->get('no_of_adult');
         $reservation->period = $data->get('period');
         $reservation->status = 'Not Paid';
         if ($reservation->save()) {
             foreach ((array) $rooms as $room) {
                 $start_date = $data->get('start_date');
                 $end_date = $data->get('end_date');
                 # ROOM VISITOR
                 $start_date = date("Y-m-d", strtotime($start_date));
                 while (strtotime($start_date) < strtotime($end_date)) {
                     $reservation_room = new ReservationRoom();
                     $reservation_room->reservation_id = $reservation->id;
                     $reservation_room->room_id = $room;
                     $reservation_room->date_reserved = $start_date;
                     $reservation_room->save();
                     $start_date = date("Y-m-d", strtotime("+1 day", strtotime($start_date)));
                 }
             }
         }
         Mail::send('emails.reservation_reference', ['customer' => $customer, 'reservation' => $reservation], function ($m) use($customer) {
             $m->from('noreply@overlook-resort.com', 'Overlook Resort (noreply)');
             $m->to($customer->email, $customer->full_name())->subject('Here\'s your RESERVATION ID');
         });
         return redirect()->back()->with('message', 'Reservation was successful. We sent your reservation reference in your e-mail');
     }
 }
开发者ID:encry2024,项目名称:overlook,代码行数:85,代码来源:Reservation.php


注:本文中的app\Customer::whereEmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。