mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge branch 'dia' of https://github.com/openclassify/openclassify
This commit is contained in:
commit
d9e37b9557
@ -12,6 +12,7 @@ use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel;
|
||||
use Visiosoft\AdvsModule\OptionConfiguration\OptionConfigurationModel;
|
||||
use Visiosoft\AdvsModule\Support\Command\Currency;
|
||||
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
||||
use Visiosoft\CustomfieldsModule\CustomField\Contract\CustomFieldRepositoryInterface;
|
||||
use Visiosoft\LocationModule\City\CityModel;
|
||||
use Visiosoft\LocationModule\Country\CountryModel;
|
||||
use Visiosoft\CartsModule\Cart\Command\GetCart;
|
||||
@ -383,7 +384,25 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
|
||||
public function customfields()
|
||||
{
|
||||
return $this->hasMany('Visiosoft\CustomfieldsModule\CustomFieldAdv\CustomFieldAdvModel', 'parent_adv_id', 'id');
|
||||
if ($cFs = (array) json_decode($this->cf_json)) {
|
||||
$cFs = array_keys($cFs);
|
||||
|
||||
$cFIDs = array_map(function ($cF) {
|
||||
return ltrim($cF, 'cf');
|
||||
}, $cFs);
|
||||
|
||||
return app(CustomFieldRepositoryInterface::class)
|
||||
->newQuery()
|
||||
->whereIn('id', $cFIDs)
|
||||
->get();
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function cFJSON()
|
||||
{
|
||||
return (array) json_decode($this->cf_json);
|
||||
}
|
||||
|
||||
// public function getCustomFieldEditId($id) {
|
||||
|
||||
@ -60,6 +60,8 @@ interface AdvInterface extends EntryInterface
|
||||
|
||||
public function customfields();
|
||||
|
||||
public function cFJSON();
|
||||
|
||||
public function priceFormat($adv);
|
||||
|
||||
public function AddAdsDefaultCoverImage($ad);
|
||||
|
||||
@ -128,18 +128,6 @@ class AdvsController extends AdminController
|
||||
$newAdvOption->save();
|
||||
}
|
||||
|
||||
// Replicate ad custom fields
|
||||
$advCustomFields = $this->model->is_enabled('customfields');
|
||||
if ($advCustomFields) {
|
||||
$advCustomFields = app('Visiosoft\CustomfieldsModule\CustomFieldAdv\Contract\CustomFieldAdvRepositoryInterface')
|
||||
->newQuery()->where('parent_adv_id', $advID)->get();
|
||||
foreach ($advCustomFields as $advCustomField) {
|
||||
$newaAdvCustomField = $advCustomField->replicate();
|
||||
$newaAdvCustomField->parent_adv_id = $newAdv->id;
|
||||
$newaAdvCustomField->save();
|
||||
}
|
||||
}
|
||||
|
||||
$this->messages->success(trans('visiosoft.module.advs::message.replicated_success'));
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user