Exemplo n.º 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     App\OptionBusinessDistribution::create(['name' => 'Diáfana']);
     App\OptionBusinessDistribution::create(['name' => '1 a 2 estancias']);
     App\OptionBusinessDistribution::create(['name' => '2 a 5 estancias']);
     App\OptionBusinessDistribution::create(['name' => '5 a 10 estancias']);
     App\OptionBusinessDistribution::create(['name' => 'Más de 10 estancias']);
     \App\OptionBusinessFacade::create(['name' => 'Sin fachada']);
     \App\OptionBusinessFacade::create(['name' => '1 a 4 metros']);
     \App\OptionBusinessFacade::create(['name' => '5 a 8 metros']);
     \App\OptionBusinessFacade::create(['name' => '9 a 12 metros']);
     \App\OptionBusinessFacade::create(['name' => 'Más de 12 metros']);
     \App\OptionBusinessLocation::create(['name' => 'En centro comercial']);
     \App\OptionBusinessLocation::create(['name' => 'A pie de calle']);
     \App\OptionBusinessLocation::create(['name' => 'Entreplanta']);
     \App\OptionBusinessLocation::create(['name' => 'Subterráneo']);
     \App\OptionBusinessLocation::create(['name' => 'Otros']);
     \App\OptionCurrentTenantsGender::create(['name' => 'Chico(s) y chica(s)']);
     \App\OptionCurrentTenantsGender::create(['name' => 'Sólo chico(s)']);
     \App\OptionCurrentTenantsGender::create(['name' => 'Sólo chica(s)']);
     \App\OptionGarageCapacity::create(['name' => 'Coche pequeño']);
     \App\OptionGarageCapacity::create(['name' => 'Coche grande']);
     \App\OptionGarageCapacity::create(['name' => 'Moto']);
     \App\OptionGarageCapacity::create(['name' => 'Coche y moto']);
     \App\OptionGarageCapacity::create(['name' => 'Dos coches o más']);
     \App\OptionNearestTownDistance::create(['name' => 'No lo sé']);
     \App\OptionNearestTownDistance::create(['name' => 'En núcleo urbano']);
     \App\OptionNearestTownDistance::create(['name' => 'Menos de 500 m']);
     \App\OptionNearestTownDistance::create(['name' => 'Entre 500 m y 1 km']);
     \App\OptionNearestTownDistance::create(['name' => 'De 1 a 2 km']);
     \App\OptionNearestTownDistance::create(['name' => 'De 2 a 5 km']);
     \App\OptionNearestTownDistance::create(['name' => 'De 5 a 10 km']);
     \App\OptionNearestTownDistance::create(['name' => 'Más de 10 km']);
     App\OptionOfficeDistribution::create(['name' => 'Diáfana']);
     App\OptionOfficeDistribution::create(['name' => 'Dividida con mamparas']);
     App\OptionOfficeDistribution::create(['name' => 'Dividida con tabiques']);
     \App\OptionPaymentDay::create(['name' => 'A la entrega de las llaves']);
     \App\OptionPaymentDay::create(['name' => 'Días antes de la entrada']);
     \App\OptionPaymentDay::create(['name' => 'El día de entrada']);
     \App\OptionPaymentDay::create(['name' => 'El día de salida']);
     \App\OptionSurroundings::create(['name' => 'Entorno de playa']);
     \App\OptionSurroundings::create(['name' => 'Entorno de esquí']);
     \App\OptionSurroundings::create(['name' => 'Entorno rural']);
     \App\OptionSurroundings::create(['name' => 'Entorno de ciudad']);
     \App\OptionTenantGender::create(['name' => 'Da igual']);
     \App\OptionTenantGender::create(['name' => 'Chico']);
     \App\OptionTenantGender::create(['name' => 'Chica']);
     \App\OptionTenantMinStay::create(['name' => '1 mes']);
     \App\OptionTenantMinStay::create(['name' => '2 meses']);
     \App\OptionTenantMinStay::create(['name' => '3 meses']);
     \App\OptionTenantMinStay::create(['name' => '4 meses']);
     \App\OptionTenantMinStay::create(['name' => '5 meses']);
     \App\OptionTenantMinStay::create(['name' => '6 o más meses']);
     \App\OptionTenantOccupation::create(['name' => 'Da igual']);
     \App\OptionTenantOccupation::create(['name' => 'Estudiante']);
     \App\OptionTenantOccupation::create(['name' => 'Con trabajo']);
     \App\OptionTenantSexualOrientation::create(['name' => 'Da igual']);
     \App\OptionTenantSexualOrientation::create(['name' => 'Gay friendly']);
     \App\EnergyCertification::create(['name' => 'Aún no disponible']);
     \App\EnergyCertification::create(['name' => 'A']);
     \App\EnergyCertification::create(['name' => 'B']);
     \App\EnergyCertification::create(['name' => 'C']);
     \App\EnergyCertification::create(['name' => 'D']);
     \App\EnergyCertification::create(['name' => 'E']);
     \App\EnergyCertification::create(['name' => 'F']);
     \App\EnergyCertification::create(['name' => 'G']);
     \App\EnergyCertification::create(['name' => 'Inmueble exento']);
     \App\EnergyCertification::create(['name' => 'En trámite']);
 }
Exemplo n.º 2
0
 public function adProfile($id)
 {
     $Ad = Ad::findOrFail($id);
     //specific operation and typology codes for the profile page
     $txt = explode('_', $Ad->local_table, 2);
     switch ($txt[0]) {
         case 'sell':
             switch ($txt[1]) {
                 case 'house':
                     $ad = SellHouse::findOrFail($Ad->local_id);
                     break;
                 case 'apartment':
                     $ad = SellApartment::findOrFail($Ad->local_id);
                     break;
                 case 'country_house':
                     $ad = SellCountryHouse::findOrFail($Ad->local_id);
                     break;
                 case 'business':
                     $ad = SellBusiness::findOrFail($Ad->local_id);
                     break;
                 case 'office':
                     $ad = SellOffice::findOrFail($Ad->local_id);
                     break;
                 case 'garage':
                     $ad = SellGarage::findOrFail($Ad->local_id);
                     break;
                 case 'land':
                     $ad = SellLand::findOrFail($Ad->local_id);
                     break;
             }
             break;
         case 'rent':
             switch ($txt[1]) {
                 case 'house':
                     $ad = RentHouse::findOrFail($Ad->local_id);
                     break;
                 case 'apartment':
                     $ad = RentApartment::findOrFail($Ad->local_id);
                     break;
                 case 'country_house':
                     $ad = RentCountryHouse::findOrFail($Ad->local_id);
                     break;
                 case 'business':
                     $ad = RentBusiness::findOrFail($Ad->local_id);
                     break;
                 case 'office':
                     $ad = RentOffice::findOrFail($Ad->local_id);
                     break;
                 case 'garage':
                     $ad = RentGarage::findOrFail($Ad->local_id);
                     break;
                 case 'land':
                     $ad = RentLand::findOrFail($Ad->local_id);
                     break;
                 case 'room':
                     $ad = Room::findOrFail($Ad->local_id);
                     break;
                 case 'vacation':
                     $ad = Lodging::findOrFail($Ad->local_id);
                     break;
             }
             break;
     }
     switch ($txt[0]) {
         case 'sell':
             $operation = 0;
             break;
         case 'rent':
             $operation = 1;
             break;
     }
     switch ($txt[1]) {
         case 'house':
             $typology = 0;
             $ad->type = CategoryHouse::where('id', $ad->category_house_id)->pluck('name');
             break;
         case 'apartment':
             $typology = 1;
             if ($ad->is_duplex) {
                 $ad->type = 'Dúplex';
             } elseif ($ad->is_penthouse) {
                 $ad->type = 'Ático';
             } elseif ($ad->is_studio) {
                 $ad->type = 'Estudio';
             } else {
                 $ad->type = 'Piso';
             }
             break;
         case 'country_house':
             $typology = 2;
             $ad->type = CategoryCountryHouse::where('id', $ad->category_country_house_id)->pluck('name');
             break;
         case 'business':
             $typology = 3;
             $ad->type = CategoryBusiness::where('id', $ad->category_business_id)->pluck('name');
             $ad->distribution = OptionBusinessDistribution::where('id', $ad->business_distribution_id)->pluck('name');
             $ad->facade = OptionBusinessFacade::where('id', $ad->business_facade_id)->pluck('name');
             $ad->location = OptionBusinessLocation::where('id', $ad->business_location_id)->pluck('name');
             break;
         case 'office':
             $typology = 4;
             $ad->type = 'Oficina';
             $ad->distribution = OptionOfficeDistribution::where('id', $ad->office_distribution_id)->pluck('name');
             break;
         case 'garage':
             $typology = 5;
             $ad->type = 'Garaje';
             $ad->garage_capacity = OptionGarageCapacity::where('id', $ad->garage_capacity_id)->pluck('name');
             break;
         case 'land':
             $typology = 6;
             $ad->type = 'Terreno';
             $ad->category_land = CategoryLand::where('id', $ad->category_land_id)->pluck('name');
             $ad->nearest_town = OptionNearestTownDistance::where('id', $ad->nearest_town_distance_id)->pluck('name');
             break;
         case 'room':
             $typology = 7;
             $ad->type = 'Habitación';
             $ad->category_room = CategoryRoom::where('id', $ad->category_room_id)->pluck('name');
             $ad->min_stay = OptionTenantMinStay::where('id', $ad->tenant_min_stay_id)->pluck('name');
             $ad->current_gender = OptionCurrentTenantsGender::where('id', $ad->current_tenants_gender_id)->pluck('name');
             $ad->gender = OptionTenantGender::where('id', $ad->tenant_gender_id)->pluck('name');
             $ad->occupation = OptionTenantOccupation::where('id', $ad->tenant_occupation_id)->pluck('name');
             $ad->sexual_orientation = OptionTenantSexualOrientation::where('id', $ad->tenant_sexual_orientation_id)->pluck('name');
             break;
         case 'vacation':
             $typology = 8;
             $ad->type = CategoryLodging::where('id', $ad->category_lodging_id)->pluck('name');
             $ad->surroundings = OptionSurroundings::where('id', $ad->surroundings_id)->pluck('name');
             $ad->min_price_per_night = \DB::select(\DB::raw("\n                  SELECT MIN(t2.p_one_month) as min_price_per_night\n                  FROM rent_vacation AS t1\n                  LEFT JOIN vacation_season_price AS t2 ON t1.id = t2.rent_vacation_id\n                  WHERE t1.id = ?;\n                "), [$ad->id]);
             $ad->season_prices = SeasonPrice::where('rent_vacation_id', $ad->id)->get();
             $ad->payment_day = OptionPaymentDay::where('id', $ad->payment_day_id)->pluck('name');
             break;
     }
     return view('ad', compact('ad', 'operation', 'typology'));
 }