rename models and associates, isolate botanic with shop

This commit is contained in:
Ludovic CANDELLIER
2020-04-21 00:09:32 +02:00
parent c80b0f1edf
commit 4ad1f18310
234 changed files with 13899 additions and 3230 deletions

View File

@@ -1,17 +1,17 @@
<?php
namespace App\Models\Shop;
namespace App\Models\Botanic;
use Illuminate\Database\Eloquent\Model;
class Family extends Model
{
protected $guarded = ['id'];
protected $table = 'shop_product_families';
protected $table = 'botanic_families';
public function genres()
{
return $this->hasMany('App\Models\Shop\Genre');
return $this->hasMany('App\Models\Botanic\Genre');
}
public function scopeByName($query,$name)

View File

@@ -1,22 +1,22 @@
<?php
namespace App\Models\Shop;
namespace App\Models\Botanic;
use Illuminate\Database\Eloquent\Model;
class Genre extends Model
{
protected $guarded = ['id'];
protected $table = 'shop_product_genres';
protected $table = 'botanic_genres';
public function family()
{
return $this->belongsTo('App\Models\Shop\Family');
return $this->belongsTo('App\Models\Botanic\Family');
}
public function species()
{
return $this->hasMany('App\Models\Shop\Specie');
return $this->hasMany('App\Models\Botanic\Specie');
}
public function scopeByName($query,$name)

View File

@@ -1,22 +1,22 @@
<?php
namespace App\Models\Shop;
namespace App\Models\Botanic;
use Illuminate\Database\Eloquent\Model;
class Specie extends Model
{
protected $guarded = ['id'];
protected $table = 'shop_product_species';
protected $table = 'botanic_species';
public function Genre()
{
return $this->belongsTo('App\Models\Shop\Family');
return $this->belongsTo('App\Models\Botanic\Family');
}
public function Varieties()
{
return $this->hasMany('App\Models\Shop\Variety');
return $this->hasMany('App\Models\Botanic\Variety');
}
public function scopeByName($query,$name)

View File

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

View File

@@ -4,45 +4,34 @@ namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
use Rinvex\Categories\Traits\Categorizable;
class Product extends Model
{
use Categorizable;
protected $guarded = ['id'];
protected $table = 'shop_products';
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function Inventories()
{
return $this->hasMany('App\Models\Shop\Inventory');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function Prices()
{
return $this->hasMany('App\Models\Shop\ProductPrice');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function ProductAttributes()
{
return $this->hasMany('App\Models\Shop\ProductAttribute');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function Categories()
{
return $this->hasMany('App\Models\Shop\CategoryProduct');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function InvoiceItems()
{
return $this->hasMany('App\Models\Shop\InvoiceItem');

View File

@@ -6,8 +6,9 @@ use Illuminate\Database\Eloquent\Model;
class ProductSection extends Model
{
protected $guarded = ['id'];
protected $guarded = ['id'];
protected $table = 'shop_product_sections';
public function Product()
{
return $this->belongsTo('App\Models\Shop\Product');

View File

@@ -4,12 +4,17 @@ namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
use Rinvex\Categories\Traits\Categorizable,
use Rinvex\Categories\Traits\Categorizable;
class Section extends Model
{
use Categorizable;
protected $guarded = ['id'];
protected $table = 'shop_sections';
public function Category()
{
return $this->hasMany('App\Models\Category');
}
public function Products()
{