remove old models
This commit is contained in:
@@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models\Shop;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class Price extends Model
|
|
||||||
{
|
|
||||||
protected $guarded = ['id'];
|
|
||||||
|
|
||||||
protected $table = 'shop_prices';
|
|
||||||
|
|
||||||
public function article()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Article::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function article_family()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(ArticleNature::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function scopeByArticle($query, $id)
|
|
||||||
{
|
|
||||||
return $query->where($this->table.'.article_id', $id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function scopeByArticleNature($query, $id)
|
|
||||||
{
|
|
||||||
return $query->where($this->table.'.article_family_id', $id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models\Shop;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class PriceGenericCategory extends Model
|
|
||||||
{
|
|
||||||
protected $guarded = ['id'];
|
|
||||||
|
|
||||||
protected $table = 'shop_price_generic_categories';
|
|
||||||
|
|
||||||
public function article_family()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(ArticleNature::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function price_generics()
|
|
||||||
{
|
|
||||||
return $this->hasMany(PriceGeneric::class, 'category_id');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Repositories\Shop;
|
|
||||||
|
|
||||||
use App\Models\Shop\Price;
|
|
||||||
use App\Traits\Model\Basic;
|
|
||||||
|
|
||||||
class Prices
|
|
||||||
{
|
|
||||||
use Basic;
|
|
||||||
|
|
||||||
public static function getByArticle($id)
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'prices' => Price::byArticle($id)->notGeneric()->get()->toArray(),
|
|
||||||
'generics' => Price::byArticle($id)->generic()->with([
|
|
||||||
'generic.prices',
|
|
||||||
'generic.category',
|
|
||||||
])->get()->toArray(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getModel()
|
|
||||||
{
|
|
||||||
return Price::query();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user