public function getEdit($id = NULL)
 {
     if (isset($id)) {
         $habitacion = Habitacion::find($id);
         $tiposhabitacion = Tipohabitacion::all()->lists('nombre', 'id');
         $pisos = Piso::all()->lists('nombre', 'id');
         $preciodia = PrecioHabitacion::where('descripcion', '=', 'dia')->where('habitacion_id', '=', $habitacion->id)->first()->precio;
         $preciohora = PrecioHabitacion::where('descripcion', '=', 'hora')->where('habitacion_id', '=', $habitacion->id)->first()->precio;
         $especial = PrecioHabitacion::where('descripcion', '=', 'especial')->where('habitacion_id', '=', $habitacion->id)->first();
         if (!isset($especial)) {
             $especial = PrecioHabitacion::create(['habitacion_id' => $habitacion->id, 'descripcion' => 'especial', 'precio' => 0.0]);
             $precioespecial = $especial->precio;
         } else {
             $precioespecial = $especial->precio;
         }
         return View::make('habitaciones.edit', compact('tiposhabitacion', 'pisos', 'habitacion', 'preciodia', 'precioespecial', 'preciohora'));
     } else {
         return Redirect::to('habitaciones');
     }
 }
Exemple #2
0
 public function getPiso()
 {
     $pisos = Piso::all();
     return Response::json($pisos);
 }
Exemple #3
0
 public function run()
 {
     for ($i = 1; $i < 6; $i++) {
         Piso::create(['hotel_id' => 1, 'alias' => 'P' . $i, 'descripcion' => 'Piso ' . $i, 'nombre' => 'Piso ' . $i]);
     }
 }