1
This commit is contained in:
@@ -51,7 +51,8 @@ class VehicleNewSkusController extends BaseController
|
||||
$skuAttribute['attribute']['attribute_name'] = $attribute['attribute_name'] ;
|
||||
$skuAttribute['value']['value_name'] = $value['value_name'];
|
||||
}
|
||||
|
||||
$item['name'] = isset($item['translation']) ? $item['translation']['name'] : '';
|
||||
unset($item['translation']);
|
||||
}
|
||||
|
||||
return $item;
|
||||
|
||||
@@ -58,4 +58,20 @@ class VehicleNewSkusModel extends Model
|
||||
{
|
||||
return $this->hasMany(VehicleNewSkuAttributesModel::class, 'sku_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 单条翻译
|
||||
*/
|
||||
public function translation()
|
||||
{
|
||||
return $this->hasOne(VehicleNewSkusTranslationModel::class, 'sku_id')->where('locale', locale());
|
||||
}
|
||||
|
||||
/**
|
||||
* 多条翻译
|
||||
*/
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(VehicleNewSkusTranslationModel::class, 'sku_id');
|
||||
}
|
||||
}
|
||||
@@ -35,9 +35,9 @@ class VehicleNewSkusService extends BaseService
|
||||
'filters' => $params['filters'],
|
||||
'fields' => ['id','vehicle_id','status'],
|
||||
'relations' => [
|
||||
'translation' => ['sku_id', 'name', 'locale'],
|
||||
'skuAttributes' => [],
|
||||
'skuAttributes.attribute' => ['id', 'input_type', 'is_img', 'status'],
|
||||
// 'skuAttributes.attribute.translation' => ['attribute_name'],
|
||||
'skuAttributes.value' => ['id','color_code'],
|
||||
],
|
||||
'sorts' => [
|
||||
@@ -58,8 +58,8 @@ class VehicleNewSkusService extends BaseService
|
||||
'relations' => [
|
||||
'skuAttributes' => [],
|
||||
'skuAttributes.attribute' => ['id', 'input_type', 'is_img', 'status'],
|
||||
// 'skuAttributes.attribute.translation' => ['attribute_name'],
|
||||
'skuAttributes.value' => ['id','color_code'],
|
||||
'translation' => ['sku_id', 'name', 'locale'],
|
||||
],
|
||||
];
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user