sarga/packages/Webkul/Product/src/Models/ProductAttributeValue.php

68 lines
1.5 KiB
PHP
Raw Normal View History

2018-07-31 07:50:54 +00:00
<?php
namespace Webkul\Product\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Attribute\Models\Attribute;
use Webkul\Product\Models\Product;
use Webkul\Channel\Models\Channel;
2018-07-31 07:50:54 +00:00
class ProductAttributeValue extends Model
{
public $timestamps = false;
protected $with = ['attribute'];
2018-08-09 04:35:13 +00:00
/**
* @var array
*/
public static $attributeTypeFields = [
'text' => 'text_value',
'textarea' => 'text_value',
'price' => 'float_value',
'boolean' => 'boolean_value',
'select' => 'integer_value',
'multiselect' => 'text_value',
'datetime' => 'datetime_time',
'date' => 'date_value',
];
protected $fillable = [
'product_id',
'attribute_id',
'channel_id',
'locale',
2018-08-09 04:35:13 +00:00
'channel',
'text_value',
'boolean_value',
'integer_value',
'float_value',
'datetime_value',
'date_value',
'json_value'
];
2018-07-31 07:50:54 +00:00
/**
* Get the attribute that owns the attribute value.
2018-07-31 07:50:54 +00:00
*/
public function attribute()
2018-07-31 07:50:54 +00:00
{
return $this->belongsTo(Attribute::class);
2018-07-31 07:50:54 +00:00
}
/**
* Get the product that owns the attribute value.
*/
public function product()
{
return $this->belongsTo(Product::class);
}
/**
* Get the channel that owns the attribute value.
*/
public function channel()
{
return $this->belongsTo(Channel::class);
}
2018-07-31 07:50:54 +00:00
}