Ejemplo n.º 1
0
     $features->indoor_fireplace = on2true($request->get('indoor_fireplace', false));
     $features->buzzer_wireless_intercom = on2true($request->get('buzzer_wireless_intercom', false));
     $features->doorman = on2true($request->get('doorman', false));
     $features->pool = on2true($request->get('pool', false));
     $features->hot_tub = on2true($request->get('hot_tub', false));
     $features->gym = on2true($request->get('gym', false));
     $features->feature_24_hour_check_in = on2true($request->get('feature_24_hour_check_in', false));
     $features->hangers = on2true($request->get('hangers', false));
     $features->iron = on2true($request->get('iron', false));
     $features->hair_dryer = on2true($request->get('hair_dryer', false));
     $features->laptop_friendly_workspace = on2true($request->get('laptop_friendly_workspace', false));
     $features->save();
     return redirect(url('property'));
 });
 Route::delete('/property/{property}', function (Property $property) {
     $property->delete();
     return redirect(url('property'));
 });
 Route::post('/property/request_booking/', array('middleware' => 'auth', function (Request $request) {
     $data = $request->all();
     $validator = Validator::make($request->all(), ['check_in' => 'required|after:yesterday|date', 'check_out' => 'required|after:check_in|date', 'property_id' => 'required|numeric|integer|min:0']);
     if ($validator->fails()) {
         return redirect(url('/property/' . $data['property_id']))->withInput()->withErrors($validator);
     }
     $property_id = $data['property_id'];
     $select_statement = 'SELECT * FROM bookings WHERE ' . "'" . $data['check_in'] . "'" . ' <= bookings.end AND ' . "'" . $data['check_out'] . "'" . ' >= START AND bookings.status = ' . "'" . 'confirmed' . "'" . 'AND bookings.property_id = ' . $property_id;
     $overlapping_bookings = DB::select($select_statement);
     if (count($overlapping_bookings) > 0) {
         $errorArr = array();
         foreach ($overlapping_bookings as $overlapping_booking) {
             array_push($errorArr, 'Sorry, there is already a booking from ' . date('F d, Y', strtotime($overlapping_booking->start)) . ' to ' . date('F d, Y', strtotime($overlapping_booking->end)));
Ejemplo n.º 2
0
 public function destroy(Property $property)
 {
     $property->delete();
     return redirect()->route("admin.property.index")->with("success", trans("realestateadmin::property.deleted"));
 }