File: D:/HostingSpaces/SBogers10/topswtwmobile.komma.pro/app/KommaApp/Shop/Orders/OrderProduct.php
<?php
namespace KommaApp\Shop\Orders;
use Illuminate\Database\Eloquent\Model;
class OrderProduct extends Model
{
protected $table = 'order_products';
protected $fillable = [
'order_id',
'internal_article_number',
'pick_number',
'title',
'description',
'composition',
'quantity',
'price',
'original_price',
'discount_description',
'discount_number_of_items_for_free',
'tax_name',
'tax_rate'
];
public function getCompositionAsObject()
{
if(!$this->composition) return [];
return json_decode($this->composition);
}
public function getPriceExVat()
{
return $this->price / (1 + ($this->tax_rate / 100));
}
public function getOriginalPriceExVat()
{
return $this->original_price / (1 + ($this->tax_rate / 100));
}
}