mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
remove function
This commit is contained in:
parent
a8c160b94f
commit
4d56b4baf7
@ -485,117 +485,8 @@ class AdvsController extends PublicController
|
||||
$adv->save();
|
||||
}
|
||||
}
|
||||
if ($advModel->is_enabled('customfields')) {
|
||||
|
||||
$customField_model = new CustomFieldModel();
|
||||
if ($adv->slug == "") {
|
||||
//new ads
|
||||
$jsonVal = [];
|
||||
$id = auth()->user()->id;
|
||||
$adv_id = $advRepository->getLastAd($id);
|
||||
|
||||
for ($i = 1; $i < 7; $i++) {
|
||||
$cat = 'cat' . $i;
|
||||
if ($request->$cat != 0) {
|
||||
$findcustomfields = $customField_model->getCustomfieldsJoinCategoryWithCategoryID($cat);
|
||||
foreach ($findcustomfields as $findcustomfield) {
|
||||
$cs_name = 'cf__' . $findcustomfield->slug;
|
||||
$cf_id = "cf" . $findcustomfield->id;
|
||||
if ($request->$cs_name) {
|
||||
$new_cs = new CustomfieldsCustomFieldAdvsEntryModel();
|
||||
$new_cs->parent_adv_id = $adv_id;
|
||||
$new_cs->custom_field_category_id = $findcustomfield->id;
|
||||
$new_cs->custom_field_type = $findcustomfield->type;
|
||||
if (is_array($request->$cs_name)) {
|
||||
$new_cs->custom_field_value = implode(',', $request->$cs_name);
|
||||
} else {
|
||||
$new_cs->custom_field_value = $request->$cs_name;
|
||||
}
|
||||
$jsonVal[$cf_id] = $request->$cs_name;
|
||||
$new_cs->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$findcustomfields = $customField_model->getCustomfieldsJoinCategoryWithCategoryID();
|
||||
foreach ($findcustomfields as $findcustomfield) {
|
||||
$cs_name = 'cf__' . $findcustomfield->slug;
|
||||
$cf_id = "cf" . $findcustomfield->id;
|
||||
if ($request->$cs_name) {
|
||||
$new_cs = new CustomfieldsCustomFieldAdvsEntryModel();
|
||||
$new_cs->parent_adv_id = $adv_id;
|
||||
$new_cs->custom_field_category_id = $findcustomfield->id;
|
||||
$new_cs->custom_field_type = $findcustomfield->type;
|
||||
if (is_array($request->$cs_name)) {
|
||||
$new_cs->custom_field_value = implode(',', $request->$cs_name);
|
||||
} else {
|
||||
$new_cs->custom_field_value = $request->$cs_name;
|
||||
}
|
||||
$jsonVal[$cf_id] = $request->$cs_name;
|
||||
$new_cs->save();
|
||||
}
|
||||
}
|
||||
|
||||
$adv->cf_json = json_encode($jsonVal);
|
||||
$adv->save();
|
||||
|
||||
} else {
|
||||
//update ads
|
||||
$jsonVal = [];
|
||||
for ($i = 1; $i < 7; $i++) {
|
||||
$cat = 'cat' . $i;
|
||||
if ($request->$cat != 0) {
|
||||
$findcustomfields = $customField_model->getCustomfieldsJoinCategoryWithCategoryID($cat);
|
||||
foreach ($findcustomfields as $findcustomfield) {
|
||||
|
||||
$cs_name = 'cf__' . $findcustomfield->slug;
|
||||
$cf_id = "cf" . $findcustomfield->id;
|
||||
if ($request->$cs_name) {
|
||||
$new_cs = CustomfieldsCustomFieldAdvsEntryModel::query()->where('parent_adv_id', $request->update_id)->where('custom_field_category_id', $findcustomfield->id)->first();
|
||||
if (!$new_cs) {
|
||||
$new_cs = new CustomfieldsCustomFieldAdvsEntryModel();
|
||||
}
|
||||
$new_cs->parent_adv_id = $adv->id;
|
||||
$new_cs->custom_field_category_id = $findcustomfield->id;
|
||||
$new_cs->custom_field_type = $findcustomfield->type;
|
||||
if (is_array($request->$cs_name)) {
|
||||
$new_cs->custom_field_value = implode(',', $request->$cs_name);
|
||||
} else {
|
||||
$new_cs->custom_field_value = $request->$cs_name;
|
||||
}
|
||||
$jsonVal[$cf_id] = $request->$cs_name;
|
||||
$new_cs->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$findcustomfields = $customField_model->getCustomfieldsJoinCategoryWithCategoryID();
|
||||
foreach ($findcustomfields as $findcustomfield) {
|
||||
|
||||
$cs_name = 'cf__' . $findcustomfield->slug;
|
||||
$cf_id = "cf" . $findcustomfield->id;
|
||||
if ($request->$cs_name) {
|
||||
$new_cs = CustomfieldsCustomFieldAdvsEntryModel::query()->where('parent_adv_id', $request->update_id)->where('custom_field_category_id', $findcustomfield->id)->first();
|
||||
if (!$new_cs) {
|
||||
$new_cs = new CustomfieldsCustomFieldAdvsEntryModel();
|
||||
}
|
||||
$new_cs->parent_adv_id = $adv->id;
|
||||
$new_cs->custom_field_category_id = $findcustomfield->id;
|
||||
$new_cs->custom_field_type = $findcustomfield->type;
|
||||
if (is_array($request->$cs_name)) {
|
||||
$new_cs->custom_field_value = implode(',', $request->$cs_name);
|
||||
} else {
|
||||
$new_cs->custom_field_value = $request->$cs_name;
|
||||
}
|
||||
$jsonVal[$cf_id] = $request->$cs_name;
|
||||
$new_cs->save();
|
||||
}
|
||||
}
|
||||
$adv->cf_json = json_encode($jsonVal);
|
||||
$adv->save();
|
||||
|
||||
}
|
||||
if ($this->adv_model->is_enabled('customfields')) {
|
||||
app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->store($adv, $request);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user