public function edit(Request $request) { //get ad id $ad_id = $request->id; //get ad info $ad_detail = $this->ad->getAdDetail($ad_id, 0); $ad_detail->ad_price_type_1 = $ad_detail->ad_price_type_2 = $ad_detail->ad_price_type_3 = $ad_detail->ad_price; $ad_detail->condition_id_type_1 = $ad_detail->condition_id_type_3 = $ad_detail->condition_id; $ad_detail->ad_description = Util::br2nl($ad_detail->ad_description); //get ad pics $ad_pic = AdPic::where('ad_id', $ad_id)->get(); $car_model_id = array(); if (old('car_brand_id')) { if (is_numeric(old('car_brand_id')) && old('car_brand_id') > 0) { $car_models = CarModel::where('car_brand_id', old('car_brand_id'))->orderBy('car_model_name', 'asc')->get(); if (!$car_models->isEmpty()) { $car_model_id = array(0 => 'Select Car Model'); foreach ($car_models as $k => $v) { $car_model_id[$v->car_model_id] = $v->car_model_name; } } } } $ad_detail->ad_category_info = $this->category->getParentsByIdFlat($ad_detail->category_id); $ad_detail->pics = AdPic::where('ad_id', $ad_detail->ad_id)->get(); return view('admin.ad.ad_edit', ['ad_detail' => $ad_detail, 'ad_pic' => $ad_pic, 'c' => $this->category->getAllHierarhy(), 'l' => $this->location->getAllHierarhy(), 'at' => AdType::all(), 'ac' => AdCondition::all(), 'estate_construction_type' => EstateConstructionType::all(), 'estate_furnishing_type' => EstateFurnishingType::all(), 'estate_heating_type' => EstateHeatingType::all(), 'estate_type' => EstateType::all(), 'car_brand_id' => CarBrand::all(), 'car_model_id' => $car_model_id, 'car_engine_id' => CarEngine::all(), 'car_transmission_id' => CarTransmission::all(), 'car_condition_id' => CarCondition::all(), 'car_modification_id' => CarModification::all()]); }
public function index(Request $request) { return view('admin.ad_type.ad_type_list', ['modelData' => AdType::all()]); }