Minor fixes, coding standards
This commit is contained in:
@@ -5,7 +5,7 @@ namespace App\Models\Shop;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class ArticleNature extends Model
|
||||
|
||||
@@ -32,12 +32,11 @@ class Category extends Model
|
||||
|
||||
public function CategoryTree()
|
||||
{
|
||||
return $this->belongsTo(app('rinvex.categories.category'),'category_id');
|
||||
return $this->belongsTo(app('rinvex.categories.category'), 'category_id');
|
||||
}
|
||||
|
||||
public function scopeByCategory($query, $category_id)
|
||||
{
|
||||
return $query->where('category_id', $category_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class Delivery extends Model
|
||||
return $this->belongsTo(SaleChannel::class);
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
public function scopeActive()
|
||||
{
|
||||
return $this->byActive(1);
|
||||
}
|
||||
@@ -39,19 +39,18 @@ class Delivery extends Model
|
||||
return $query->where($this->table . '.at_house', 1);
|
||||
}
|
||||
|
||||
public function scopeInactive($query)
|
||||
public function scopeInactive()
|
||||
{
|
||||
return $this->byActive(0);
|
||||
}
|
||||
|
||||
public function scopeManaged($query)
|
||||
public function scopeManaged()
|
||||
{
|
||||
return $this->byPublic(0);
|
||||
}
|
||||
|
||||
public function scopePublic($query)
|
||||
public function scopePublic()
|
||||
{
|
||||
return $this->byPublic(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,17 +8,11 @@ class InvoiceItem extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function Product()
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function Invoice()
|
||||
{
|
||||
return $this->belongsTo(Invoice::class);
|
||||
|
||||
@@ -8,17 +8,11 @@ class Order extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function Customer()
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Payments()
|
||||
{
|
||||
return $this->hasMany(OrderPayment::class);
|
||||
|
||||
@@ -8,9 +8,6 @@ class OrderPayment extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function Order()
|
||||
{
|
||||
return $this->belongsTo(Order::class);
|
||||
|
||||
@@ -32,16 +32,16 @@ class PriceList extends Model
|
||||
|
||||
public function scopeByTariff($query, $id)
|
||||
{
|
||||
return $query->where($this->table . '.tariff_id', $id);
|
||||
return $query->where($this->table . '.tariff_id', $id);
|
||||
}
|
||||
|
||||
public function scopeBySaleChannel($query, $id)
|
||||
{
|
||||
return $query->where($this->table . '.sale_channel_id', $id);
|
||||
return $query->where($this->table . '.sale_channel_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByStatus($query, $id)
|
||||
{
|
||||
return $query->where($this->table . '.status_id', $id);
|
||||
return $query->where($this->table . '.status_id', $id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@ namespace App\Models\Shop;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
|
||||
class PriceListValue extends Model
|
||||
{
|
||||
use BelongsToThrough, SoftDeletes, Userstamps;
|
||||
use BelongsToThrough, SoftDeletes, Userstamps;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_price_list_values';
|
||||
|
||||
@@ -13,5 +13,4 @@ class SaleChannel extends Model
|
||||
{
|
||||
return $this->hasMany(Delivery::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Tag extends Model
|
||||
{
|
||||
|
||||
protected $guarded = ['id'];
|
||||
public $translatable = ['name'];
|
||||
|
||||
@@ -19,17 +18,17 @@ class Tag extends Model
|
||||
|
||||
public function articles()
|
||||
{
|
||||
return $this->morphedByMany(Article::class,'taggable');
|
||||
return $this->morphedByMany(Article::class, 'taggable');
|
||||
}
|
||||
|
||||
public function varieties()
|
||||
{
|
||||
return $this->morphedByMany(\App\Models\Botanic\Variety::class,'taggable');
|
||||
return $this->morphedByMany(\App\Models\Botanic\Variety::class, 'taggable');
|
||||
}
|
||||
|
||||
public function species()
|
||||
{
|
||||
return $this->morphedByMany(\App\Models\Botanic\Specie::class,'taggable');
|
||||
return $this->morphedByMany(\App\Models\Botanic\Specie::class, 'taggable');
|
||||
}
|
||||
|
||||
public function group()
|
||||
|
||||
@@ -6,12 +6,10 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Taggable extends Model
|
||||
{
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public function taggable()
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace App\Models\Shop;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
use Kirschbaum\PowerJoins\PowerJoins;
|
||||
use Kirschbaum\PowerJoins\PowerJoins;
|
||||
|
||||
use App\Traits\HasComments;
|
||||
|
||||
@@ -31,6 +31,13 @@ class Tariff extends Model
|
||||
return $this->hasMany(PriceList::class);
|
||||
}
|
||||
|
||||
public function scopeByAutocomplete($query, $str)
|
||||
{
|
||||
return $query->where($this->table . '.name', 'LIKE', "%${str}%")
|
||||
->orWhere($this->table . '.ref', 'LIKE', "${str}%")
|
||||
->orWhere($this->table . '.code', 'LIKE', "${str}%");
|
||||
}
|
||||
|
||||
public function scopeBySaleChanel($query, $id)
|
||||
{
|
||||
return $query->where($this->table . '.sale_channel_id', $id);
|
||||
|
||||
@@ -32,9 +32,7 @@ class Unity extends Model
|
||||
public function scopeByArticleNature($query, $id)
|
||||
{
|
||||
return $query->whereHas('package', function ($query) use ($id) {
|
||||
$query->byArticleNature($id);
|
||||
}
|
||||
);
|
||||
$query->byArticleNature($id);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Models\Shop;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use App\Traits\HasComments;
|
||||
|
||||
class Variation extends Model
|
||||
{
|
||||
use HasComments;
|
||||
|
||||
Reference in New Issue
Block a user