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


PHP Reservation::where方法代码示例

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


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

示例1: fire

 /**
  * Execute the console command
  *
  * @return void
  */
 public function fire()
 {
     // check if the provided user exists
     $user = User::where('username', '=', $this->option('user'))->first();
     if (!isset($user)) {
         $this->comment("This user don't exist.");
         return;
     }
     // check if the provided reservation exists and delete it
     $reservation = Reservation::where('id', '=', $this->argument('id'))->where('user_id', '=', $user->id)->first();
     if (isset($reservation)) {
         $reservation->delete();
         $this->info("Reservation '{$reservation->id}' has been deleted.");
     } else {
         $this->comment("This reservation do not exist.");
     }
     return;
 }
开发者ID:tallcoder,项目名称:Reservations,代码行数:23,代码来源:DeleteReservation.php

示例2: reserve_post

 public function reserve_post($id)
 {
     // GET THE LAST RESERVATION
     $last_user_reservation = Reservation::where('user_id', Sentry::getUser()->id)->orderBy('created_at', 'desc')->first();
     if (!is_null($last_user_reservation)) {
         $current_time = time();
         $last_user_reservation_time = strtotime($last_user_reservation->created_at);
         $interval = abs($current_time - $last_user_reservation_time) / 3600;
         if ($interval < 15) {
             return Redirect::to('clients')->with('info', 'You must wait 15 hours before you can reserve again.');
         }
     }
     if (is_null(Property::find($id))) {
         return Redirect::to('properties');
     }
     $monitoring = Monitoring::where('block', Input::get('block'))->where('lot', Input::get('lot')) - first();
     if (!is_null($monitoring) && $monitoring->status == false) {
         return Redirect::to('clients')->with('info', 'This slut is not available sorry.');
     }
     $rules = array('total_contract_price' => 'required', 'reservation_fee' => 'required', 'downpayment' => 'required', 'equity' => 'required', 'total_months' => 'required', 'monthly_fee' => 'required', 'agent_id' => 'required', 'terms' => 'required', 'block' => 'required|numeric', 'lot' => 'required|numeric');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('clients/reserve/' . $id)->withInput()->withErrors($validator);
     } else {
         $property = Property::find($id);
         $user = $this->user;
         // 0. CHANGE PROPERTY STATUS TO 0
         $downpayment = intval(Input::get('downpayment')) / 100 * $property->price;
         $equity = $property->price - $downpayment - $property->reservation_fee;
         $total_months = intval(Input::get('total_months'));
         // 1. SAVE TO THE DATABASE
         $reservation = new Reservation();
         $reservation->property_id = $id;
         $reservation->user_id = $this->user->id;
         $reservation->agent_id = Input::get('agent_id');
         $reservation->total_contract_price = intval(Input::get('total_contract_price'));
         $reservation->downpayment = $downpayment;
         $reservation->reservation_fee = $property->reservation_fee;
         $reservation->block = Input::get('block');
         $reservation->lot = Input::get('lot');
         // LOANABLE AMOUNT
         $reservation->equity = $equity;
         $reservation->total_months = $total_months;
         $reservation->monthly_fee = $equity / $total_months;
         $reservation->terms = Input::get('terms');
         //$reservation->unit_type = Input::get('unit_type');
         $reservation->save();
         // 2. NEW TRANSACTION
         $transaction = new Transaction();
         $transaction->reference_number = date('Ymd') . '-' . strtoupper(str_random(5));
         $transaction->property_id = $id;
         $transaction->user_id = $this->user->id;
         $transaction->reservation_id = $reservation->id;
         $transaction->status = 'Pending';
         $transaction->amount = $property->reservation_fee;
         $transaction->remarks = "Property Reservation";
         $transaction->save();
         // UPDATE MONITORING
         DB::table('monitorings')->where('block', Input::get('block'))->where('lot', Input::get('lot'))->update(array('status' => false));
         // 3.GENERATE INVOICE
         $x = View::make('admin.transactions.show', compact('transaction', 'user', 'property'));
         $pdf = storage_path() . '/invoices/' . $transaction->reference_number . '.pdf';
         $dompdf = new DOMPDF();
         $dompdf->load_html($x);
         $dompdf->render();
         $output = $dompdf->output();
         @file_put_contents($pdf, $output);
         // 3.1 GENERATE RESERVATION INFORMATION PDF
         $y = View::make('admin.reservations.pdf', compact('transaction', 'user', 'reservation', 'property'));
         $res = storage_path() . '/reservations/reservation-' . $transaction->reference_number . '.pdf';
         $dompdf = new DOMPDF();
         $dompdf->load_html($y);
         $dompdf->render();
         $output = $dompdf->output();
         @file_put_contents($res, $output);
         // 4. EMAIL DEVELOPER,ADMIN AND BUYER
         $admin = User::find(1);
         $developer = $property->developer;
         $data['transaction'] = $transaction;
         Mail::send('mails.default', $data, function ($message) use($transaction, $pdf, $developer, $admin, $res) {
             $user = Sentry::getUser();
             $message->to($user->email)->subject("Property Reservation Notification");
             $message->to($developer->email)->subject("Property Reservation Notification");
             $message->to($admin->email)->subject("Property Reservation Notification");
             $message->attach($pdf);
             $message->attach($res);
         });
         return Redirect::to('clients')->with('success', 'Your reservation has been sent to administrator for approval.');
     }
 }
开发者ID:jacobDaeHyung,项目名称:Laravel-Real-Estate-Manager,代码行数:90,代码来源:PublicClientsController.php

示例3: reservations

 public function reservations($id)
 {
     $this->_exists($id);
     $user = User::find($id);
     $reservations = Reservation::where('user_id', $id)->get();
     return View::make('admin.reservations.index', compact('reservations', 'user'));
 }
开发者ID:jacobDaeHyung,项目名称:Laravel-Real-Estate-Manager,代码行数:7,代码来源:ClientsController.php

示例4: messages

 public function messages()
 {
     $reservation = Reservation::where('status', '=', 'Payment Pending')->orWhere('status', '=', 'Half Paid')->get();
     if (!$reservation) {
         return Redirect::back()->withErrors('Could not find reservation');
     }
     return View::make('admin.messages', compact('reservation'));
 }
开发者ID:jmramos02,项目名称:catering,代码行数:8,代码来源:AdminController.php

示例5: getCancel

 /**
  * Cancel a reservation by code.
  * @param  Cluster $cluster
  * @param  string  $code
  */
 public function getCancel(Cluster $cluster, $code)
 {
     // Get the reservation object
     $reservation = Reservation::where('code', $code)->first();
     if ($reservation == null) {
         if ($reservation == null) {
             return View::make('cancelled');
         }
     }
     // Delete the reservation
     Reservation::where('code', $code)->delete();
     // Show some HTML
     return View::make('cancelled');
 }
开发者ID:tallcoder,项目名称:Reservations,代码行数:19,代码来源:ReservationController.php


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