[WIP] Fix ergonomics rules
This commit is contained in:
@@ -8,25 +8,16 @@ class Customer extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Invoices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Invoice');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Orders()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Order');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function User()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
|
||||
21
app/Models/Shop/CustomerAddress.php
Normal file
21
app/Models/Shop/CustomerAddress.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CustomerAddress extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public function Customer()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Customer');
|
||||
}
|
||||
|
||||
public function Orders()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Order');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,19 +8,19 @@ class ProductPrice extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function Product()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Product');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function ProductAttribute()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ProductAttribute');
|
||||
}
|
||||
|
||||
public function scopeByProduct($query, $id)
|
||||
{
|
||||
return $query->where('product_id', $id);
|
||||
}
|
||||
|
||||
}
|
||||
30
app/Models/Shop/ProductSection.php
Normal file
30
app/Models/Shop/ProductSection.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProductSection extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public function Product()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Product');
|
||||
}
|
||||
|
||||
public function Section()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Product');
|
||||
}
|
||||
|
||||
public function scopeByProduct($query, $id)
|
||||
{
|
||||
return $query->where('product_id', $id);
|
||||
}
|
||||
|
||||
public function scopeBySection($query, $id)
|
||||
{
|
||||
return $query->where('section_id', $id);
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,13 @@ namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Rinvex\Categories\Traits\Categorizable,
|
||||
|
||||
class Section extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
use Categorizable;
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Products()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Product');
|
||||
|
||||
Reference in New Issue
Block a user