#654 [customfields] Improvments

This commit is contained in:
diashalabi 2021-10-10 17:43:31 +03:00
parent d7bdfcef5d
commit b771f0bc9b
2 changed files with 12 additions and 1 deletions

View File

@ -387,15 +387,24 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
if ($cFs = (array) json_decode($this->cf_json)) { if ($cFs = (array) json_decode($this->cf_json)) {
$cFs = array_keys($cFs); $cFs = array_keys($cFs);
$cFIDs = array_map(function ($cF) {
return ltrim($cF, 'cf');
}, $cFs);
return app(CustomFieldRepositoryInterface::class) return app(CustomFieldRepositoryInterface::class)
->newQuery() ->newQuery()
->whereIn('id', $cFs) ->whereIn('id', $cFIDs)
->get(); ->get();
} }
return []; return [];
} }
public function cFJSON()
{
return (array) json_decode($this->cf_json);
}
// public function getCustomFieldEditId($id) { // public function getCustomFieldEditId($id) {
// $custom_field = AdvsCustomFieldsEntryModel::query()->where('advs_custom_fields.id', $id)->first(); // $custom_field = AdvsCustomFieldsEntryModel::query()->where('advs_custom_fields.id', $id)->first();
// return DB::table('streams_assignments')->where('field_id', $custom_field->field_id)->first(); // return DB::table('streams_assignments')->where('field_id', $custom_field->field_id)->first();

View File

@ -60,6 +60,8 @@ interface AdvInterface extends EntryInterface
public function customfields(); public function customfields();
public function cFJSON();
public function priceFormat($adv); public function priceFormat($adv);
public function AddAdsDefaultCoverImage($ad); public function AddAdsDefaultCoverImage($ad);