Fixes after reading excel files and discuss with eric
This commit is contained in:
21
app/Models/Shop/Package.php
Normal file
21
app/Models/Shop/Package.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Package extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_packages';
|
||||
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleFamily');
|
||||
}
|
||||
|
||||
public function scopeByFamily($query, $id)
|
||||
{
|
||||
return $query->where('article_family_id', $id);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,11 @@ class PriceGenericCategory extends Model
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_price_generic_categories';
|
||||
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleFamily');
|
||||
}
|
||||
|
||||
public function price_generics()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\PriceGeneric','category_id');
|
||||
|
||||
@@ -9,13 +9,13 @@ class Unity extends Model
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_unities';
|
||||
|
||||
public function article_family()
|
||||
public function package()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleFamily');
|
||||
return $this->belongsTo('App\Models\Shop\Package');
|
||||
}
|
||||
|
||||
public function scopeByFamily($query, $id)
|
||||
public function scopeByPackage($query, $id)
|
||||
{
|
||||
return $query->where('article_family_id');
|
||||
return $query->where('package_id', $id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user