Exemple #1
0
 public function findBlogWithResponse($slug)
 {
     $blogpost = Self::where('slug', '=', $slug)->first()->toArray();
     $response = Response::where('blogs_id', '=', $blogpost['id'])->get()->toArray();
     $backarray = ['blogpost' => $blogpost, 'response' => $response];
     return $backarray;
 }
 /**
  * Reads the booking time range limits details based on
  * pass parameters.
  * 
  * @static	true
  * @access	public
  * @param	array 	$arrData
  * @return	array
  * @since	1.0.0
  */
 public static function checkBookingTimeRangeLimits($arrData)
 {
     $queryResult = Self::where('product_vendor_location_id', $arrData['vendorLocationID'])->where('day', $arrData['reservationDay'])->orWhere('date', $arrData['reservationDate'])->get();
     //array to save the details
     $arrData = array();
     foreach ($queryResult as $row) {
         $arrData[] = array('id' => $row->id, 'product_vendor_location_id' => $row->product_vendor_loction_id, 'limit_by' => $row->limit_by, 'day' => $row->day, 'date' => $row->date, 'start_time' => $row->start_time, 'end_time' => $row->end_time, 'max_covers_limit' => $row->max_covers_limit, 'max_tables_limit' => $row->max_tables_limit);
     }
     return $arrData;
 }
 /**
  *  删除设置选项
  *
  *  @param $option_name
  *
  *  @return boolean
  */
 public static function del($option_name)
 {
     $option = Self::where('name', $option_name)->first();
     if (!$option) {
         return false;
     }
     //不存在该设置选项
     $option->delete();
     return true;
 }
 public static function getLastReservationDetail($arrData)
 {
     $queryResult = Self::where('id', $arrData['reservationID'])->whereIn('reservation_status', array('new', 'edited'))->first();
     //check for outlet change
     if ($queryResult->reservation_type == "experience") {
         //-----------------------------------------------------------------------------------------------------
         $arrProductVendorLocationId = DB::table('reservation_details')->where('id', $arrData['reservationID'])->select('product_vendor_location_id')->get();
         $outletOld = self::getExperienceOutlet($arrProductVendorLocationId[0]->product_vendor_location_id);
         $outlet = self::getExperienceOutlet($arrData['vendorLocationID']);
         //--------------------------------------------------------------------------------------------------------
         if ($outletOld->name != $outlet->name) {
             //echo " , outlet changed, send to email";
             $old_reservation_outlet = $outletOld->name;
             $new_reservation_outlet = $outlet->name;
             $arrResponse['reservation_oulet'] = " Old Outlet: " . $old_reservation_outlet . " -> New Outlet: " . $new_reservation_outlet;
         } else {
             $arrResponse['reservation_oulet'] = "";
         }
     } else {
         if ($queryResult->reservation_type == "alacarte") {
             //---------------------------------------------------------------------------------------------------
             $arrVendorLocationID = DB::table('reservation_details')->where('id', $arrData['reservationID'])->select('vendor_location_id')->get();
             $outletOld = self::getAlacarteOutlet($arrVendorLocationID[0]->vendor_location_id);
             $outlet = self::getAlacarteOutlet($arrData['vendorLocationID']);
             //-------------------------------------------------------------------------------------------------------
             if ($outletOld->name != $outlet->name) {
                 //echo " , outlet changed, send to email";
                 $old_reservation_outlet = $outletOld->name;
                 $new_reservation_outlet = $outlet->name;
                 $arrResponse['reservation_oulet'] = " Old Outlet: " . $old_reservation_outlet . " -> New Outlet: " . $new_reservation_outlet;
             } else {
                 $arrResponse['reservation_oulet'] = "";
             }
         }
     }
     //check for party size change
     if ($queryResult->no_of_persons != $arrData['partySize']) {
         //echo " , party size changed, send to email";
         $old_reservation_party_size = $queryResult->no_of_persons;
         $new_reservation_party_size = $arrData['partySize'];
         $arrResponse['reservation_party_size'] = " Old Party Size: " . $old_reservation_party_size . " -> New Party Size: " . $new_reservation_party_size;
     } else {
         $arrResponse['reservation_party_size'] = "";
     }
     //check for date change
     if ($queryResult->reservation_date != $arrData['reservationDate']) {
         $old_reservation_date = $queryResult->reservation_date;
         $new_reservation_date = $arrData['reservationDate'];
         $arrResponse['reservation_date'] = " Old Date: " . $old_reservation_date . " -> New Date: " . $new_reservation_date;
     } else {
         $arrResponse['reservation_date'] = "";
     }
     //check for time change
     if ($arrData['reservationTime'] != $queryResult->reservation_time) {
         $old_reservation_time = $queryResult->reservation_time;
         $new_reservation_time = $arrData['reservationTime'];
         $arrResponse['reservation_time'] = " Old Time: " . $old_reservation_time . " -> New Time: " . $new_reservation_time;
     } else {
         $arrResponse['reservation_time'] = "";
     }
     return $arrResponse;
 }
Exemple #5
0
 public static function findOrCreate_pivotTable(Request $request, Table $model, Table $toModel)
 {
     //dd($model->namespace);
     $devis = Devis::find($request->devis_id);
     //$from_field_name = snake_case($model->model).'_id';
     //$to_field_name = snake_case($toModel->model).'_id';
     $models = array($model->model, $toModel->model);
     sort($models);
     $pivotTableName = strtolower($models[0] . '_' . $models[1]);
     $pivotTable = Self::where('devis_id', $devis->id)->where('name', $pivotTableName)->first();
     if (!$pivotTable) {
         $pivotTable = Table::create(['name' => $pivotTableName, 'devis_id' => $devis->id, 'namespace_id' => $model->namespace_id]);
     }
     return $pivotTable;
 }
Exemple #6
0
 public static function getIdByLogin($login)
 {
     return Self::where('loginClient', '=', $login)->lists('idClient')[0];
 }
Exemple #7
0
 /**
  * @return Relationship
  */
 public function group()
 {
     return Self::where('MAR_PEZ', $this->MAR_PEZ)->where('FLG_REC', 3)->get();
 }
Exemple #8
0
 public static function findLibelleSens($ligne, $sens)
 {
     return Self::where('numero', '=', $ligne)->where('sens', '=', $sens)->lists('libelleLigne')[0];
 }
 /**
  * Updates the status of the reservation to cancel.
  * 
  * @access  public
  * @static  true
  * @param integer $reservationID
  * @return  array
  * @since 1.0.0
  */
 public static function cancelReservation($reservationID, $reservationType)
 {
     //array to hold response
     $arrResponse = array();
     $queryResult = Self::where('id', $reservationID)->where('reservation_status', '!=', 'cancel')->first()->toArray();
     if ($queryResult) {
         $reservation = Self::find($reservationID);
         $reservation->reservation_status = 'cancel';
         $reservation->save();
         $arrResponse['status'] = 'ok';
     } else {
         $arrResponse['status'] = 'failed';
         $arrResponse['msg'] = 'Sorry. No Such record exists.';
     }
     return $arrResponse;
 }
Exemple #10
0
 /**
  * Retourne le nom de l'arrêt grâce à l'ID spécifiée
  */
 public static function findNameById($idArret)
 {
     return Self::where('idArret', '=', $idArret)->lists('nomArret')[0];
 }
Exemple #11
0
 public static function getMenuLinks($idSubmenu)
 {
     return Self::where('submenu', '=', $idSubmenu)->get();
 }
Exemple #12
0
 /**
  *Get the showable news for foundation
  */
 protected static function staffShowable()
 {
     return Self::where('level', self::$levels['staff'])->get();
 }