first commit

This commit is contained in:
Kevin Adametz 2021-01-08 17:48:20 +01:00
commit 0baac018a2
1011 changed files with 145854 additions and 0 deletions

View file

@ -0,0 +1,121 @@
<?php
namespace App\Models;
use App\Services\Util;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\ShippingPrice
*
* @property int $id
* @property int $shipping_id
* @property float|null $price
* @property float|null $tax_rate
* @property float|null $factor
* @property float|null $total_from
* @property float|null $total_to
* @property int|null $weight_from
* @property int|null $weight_to
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \App\Models\Shipping $shipping
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereFactor($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice wherePrice($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereShippingId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereTax($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereTotalFrom($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereTotalTo($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereWeightFrom($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereWeightTo($value)
* @mixin \Eloquent
* @property-write mixed $tax
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereTaxRate($value)
* @property float|null $price_comp
* @property int|null $num_comp
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereNumComp($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice wherePriceComp($value)
*/
class ShippingPrice extends Model
{
protected $table = 'shipping_prices';
protected $fillable = [
'shipping_id', 'price', 'price_comp', 'num_comp', 'tax_rate', 'factor', 'total_from', 'total_to', 'weight_from', 'weight_to',
];
public function shipping()
{
return $this->belongsTo('App\Models\Shipping', 'shipping_id');
}
public function setPriceAttribute($value)
{
$this->attributes['price'] = $value ? Util::reFormatNumber($value) : null;
}
public function setPriceCompAttribute($value)
{
$this->attributes['price_comp'] = $value ? Util::reFormatNumber($value) : null;
}
public function setFactorAttribute($value)
{
$this->attributes['factor'] = $value ? Util::reFormatNumber($value) : null;
}
public function setTaxAttribute($value)
{
$this->attributes['tax_rate'] = $value ? Util::reFormatNumber($value) : null;
}
public function setTotalFromAttribute($value)
{
$this->attributes['total_from'] = $value ? Util::reFormatNumber($value) : null;
}
public function setTotalToAttribute($value)
{
$this->attributes['total_to'] = $value ? Util::reFormatNumber($value) : null;
}
public function getFormattedPrice()
{
return isset($this->attributes['price']) ? Util::formatNumber($this->attributes['price']) : "";
}
public function getFormattedPriceComp()
{
return isset($this->attributes['price_comp']) ? Util::formatNumber($this->attributes['price_comp']) : "";
}
public function getFormattedTaxRate()
{
return isset($this->attributes['tax_rate']) ? Util::formatNumber($this->attributes['tax_rate']) : "";
}
public function getFormattedFactor()
{
return isset($this->attributes['factor']) ? Util::formatNumber($this->attributes['factor']) : "";
}
public function getFormatTotalFrom()
{
return isset($this->attributes['total_from']) ? Util::formatNumber($this->attributes['total_from']) : "";
}
public function getFormattedTotalTo()
{
return isset($this->attributes['total_to']) ? Util::formatNumber($this->attributes['total_to']) : "";
}
}