Attributes

This commit is contained in:
Ludovic CANDELLIER
2020-05-05 19:07:11 +02:00
parent d7917309ee
commit d0e3bb6251
11 changed files with 144 additions and 45 deletions

View File

@@ -30,7 +30,7 @@ class Article extends Model
return $this->hasMany('App\Models\Shop\ArticlePrice');
}
public function ProductAttributes()
public function ArticleAttributes()
{
return $this->hasMany('App\Models\Shop\ArticleAttribute');
}

View File

@@ -6,13 +6,13 @@ use Illuminate\Database\Eloquent\Relations\Pivot;
class ArticleAttribute extends Pivot
{
public function Article()
{
return $this->belongsTo('App\Models\Shop\Article');
}
public function article()
{
return $this->belongsTo('App\Models\Shop\Article');
}
public function Attribute()
{
return $this->belongsTo('App\Models\Shop\ArticleAttribute');
}
public function value()
{
return $this->belongsTo('App\Models\Shop\ArticleAttribute');
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
class ArticleAttributeFamily extends Model
{
protected $guarded = ['id'];
protected $table = 'shop_article_attribute_families';
public function Values()
{
return $this->hasMany('App\Models\Shop\ArticleAttributeValue','attribute_family_id');
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
class ArticleAttributeValue extends Model
{
protected $guarded = ['id'];
protected $table = 'shop_article_attribute_values';
public function attribute_family()
{
return $this->belongsTo('App\Models\Shop\ArticleAttributeFamily');
}
}