[WIP] Fix ergonomics rules

This commit is contained in:
Ludovic CANDELLIER
2020-03-30 00:48:17 +02:00
parent 36267139a1
commit cd9b6ea74c
106 changed files with 1392 additions and 747 deletions

View File

@@ -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');

View 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');
}
}

View File

@@ -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);
}
}

View 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);
}
}

View File

@@ -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');