mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-13 00:36:04 -06:00
add configuration detail
This commit is contained in:
parent
19a0238b21
commit
1a3069085b
@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Visiosoft\AdvsModule\Adv\Contract\AdvInterface;
|
||||
use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel;
|
||||
use Visiosoft\AdvsModule\OptionConfiguration\OptionConfigurationModel;
|
||||
use Visiosoft\AdvsModule\Support\Command\Currency;
|
||||
use Visiosoft\LocationModule\City\CityModel;
|
||||
use Visiosoft\LocationModule\Country\CountryModel;
|
||||
@ -27,6 +28,10 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
'thumbnail',
|
||||
];
|
||||
|
||||
protected $cascades = [
|
||||
'configurations',
|
||||
];
|
||||
|
||||
public function getDetailUrlAttribute()
|
||||
{
|
||||
// Checking for slug
|
||||
@ -36,6 +41,19 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function configurations()
|
||||
{
|
||||
return $this->hasMany(
|
||||
OptionConfigurationModel::class,
|
||||
'parent_adv_id'
|
||||
);
|
||||
}
|
||||
|
||||
public function getConfigurations()
|
||||
{
|
||||
return $this->getAttribute('configurations');
|
||||
}
|
||||
|
||||
public function getCurrencyPriceAttribute()
|
||||
{
|
||||
return app(Currency::class)->format($this->price, $this->currency);
|
||||
|
||||
@ -7,10 +7,18 @@ use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueReposit
|
||||
|
||||
class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel implements OptionConfigurationInterface
|
||||
{
|
||||
protected $appends = [
|
||||
'option_name'
|
||||
];
|
||||
|
||||
public function getOptionNameAttribute()
|
||||
{
|
||||
return $this->getName();
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
if($adv = app(AdvRepositoryInterface::class)->find($this->parent_adv_id))
|
||||
{
|
||||
if ($adv = app(AdvRepositoryInterface::class)->find($this->parent_adv_id)) {
|
||||
$configurations_item = json_decode($this->option_json, true);
|
||||
$option_group_value = "";
|
||||
|
||||
@ -21,6 +29,7 @@ class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel impleme
|
||||
|
||||
return $adv->name . ' | ' . trim($option_group_value, ' ');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function stockControl($id, $quantity)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user