Fix on AdminLTE 3, and add some features
This commit is contained in:
@@ -30,9 +30,9 @@ class Article extends Model
|
||||
return $this->hasMany('App\Models\Shop\ArticlePrice');
|
||||
}
|
||||
|
||||
public function ArticleAttributes()
|
||||
public function Attributes()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\ArticleAttribute');
|
||||
return $this->hasManyThrough('App\Models\Shop\ArticleAttribute','App\Models\Shop\ArticlePrice');
|
||||
}
|
||||
|
||||
public function Categories()
|
||||
|
||||
@@ -2,17 +2,27 @@
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ArticleAttribute extends Pivot
|
||||
class ArticleAttribute extends Model
|
||||
{
|
||||
public function article()
|
||||
public function Price()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
return $this->belongsTo('App\Models\Shop\ArticlePrice');
|
||||
}
|
||||
|
||||
public function value()
|
||||
public function Value()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleAttribute');
|
||||
}
|
||||
|
||||
public function scopeByPrice($query, $article_price_id)
|
||||
{
|
||||
return $query->where('article_price_id', $article_price_id);
|
||||
}
|
||||
|
||||
public function scopeByAttribueValue($query, $article_value_id)
|
||||
{
|
||||
return $query->where('article_value_id', $article_value_id);
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,14 @@ class ArticleAttributeValue extends Model
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_article_attribute_values';
|
||||
|
||||
public function attribute_family()
|
||||
public function AttributeFamily()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleAttributeFamily');
|
||||
}
|
||||
|
||||
public function scopeByFamily($query, $attribute_family_id)
|
||||
{
|
||||
return $query->where('attribute_family_id', $attribute_family_id);
|
||||
}
|
||||
|
||||
}
|
||||
17
app/Models/Shop/ArticleComponent.php
Normal file
17
app/Models/Shop/ArticleComponent.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ArticleComponent extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_article_components';
|
||||
|
||||
public function Article()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,9 +13,9 @@ class ArticlePrice extends Model
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function ArticleAttribute()
|
||||
public function ArticleAttributes()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleAttribute');
|
||||
return $this->hasMany('App\Models\Shop\ArticleAttribute');
|
||||
}
|
||||
|
||||
public function scopeByArticle($query, $id)
|
||||
|
||||
Reference in New Issue
Block a user