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

61 lines
1.4 KiB
PHP
Raw Normal View History

2018-07-27 06:22:12 +00:00
<?php
namespace Webkul\Product\Models;
use Illuminate\Database\Eloquent\Model;
2018-07-31 07:50:54 +00:00
use Webkul\Attribute\Models\Attribute;
2018-07-27 09:30:48 +00:00
use Webkul\Category\Models\Category;
2018-07-31 07:50:54 +00:00
use Webkul\Inventory\Models\InventorySource;
2018-07-27 06:22:12 +00:00
class Product extends Model
{
2018-07-31 07:50:54 +00:00
protected $fillable = ['type', 'attribute_family_id', 'sku'];
2018-07-27 09:30:48 +00:00
/**
* The categories that belong to the product.
*/
public function categories()
{
return $this->belongsToMany(Category::class, 'product_categories');
}
2018-07-31 07:50:54 +00:00
/**
* The inventories that belong to the product.
*/
public function inventories()
{
return $this->belongsToMany(InventorySource::class, 'product_inventories');
}
/**
* The super attributes that belong to the product.
*/
public function super_attributes()
{
return $this->belongsToMany(Attribute::class, 'product_super_attributes');
}
/**
* The related products that belong to the product.
*/
public function related_products()
{
return $this->belongsToMany(self::class, 'product_relations');
}
/**
* The up sells that belong to the product.
*/
public function up_sells()
{
return $this->belongsToMany(self::class, 'product_up_sells');
}
/**
* The cross sells that belong to the product.
*/
public function cross_sells()
{
return $this->belongsToMany(self::class, 'product_cross_sells');
}
2018-07-27 06:22:12 +00:00
}