File: /www/wwwroot/erp.nhatnamsst.com/domains/QuoteRequest/Models/QuoteRequestDetail.php
<?php
namespace Domains\QuoteRequest\Models;
use Domains\Admin\Models\Admin;
use Domains\Brand\Models\Brand;
use Domains\Core\Traits\ModelTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class QuoteRequestDetail extends Model
{
use HasFactory, ModelTrait;
protected $fillable = [
'quote_request_id',
'inter_id',
'detail_code',
'code',
'sale_description',
'inter_description',
'quantity',
'unit',
'brand_id',
'origin',
'unit_price',
'unit_cost',
'input_price_plus_cost',
'import_tax_percent',
'import_tax',
'price_with_tax',
'profit_margin_percent',
'final_unit_price',
'quantity_leader',
'total_leader',
'total',
'currency',
'manager_currency',
'delivery_time',
'delivery_time_exw',
'delivery_time_ddp',
'delivery_term',
'unit_weight_kg',
'total_weight_kg',
'gross_weight_kg',
'shipping_fee_per_kg',
'total_shipping_cost',
'customs_fee',
'other_fee',
'total_cost',
'sale_note',
'sale_manager_note',
'inter_note',
'manager_note',
];
protected function casts(): array
{
return [
'quantity' => 'decimal:2',
'unit_price' => 'decimal:2',
'unit_cost' => 'decimal:2',
'input_price_plus_cost' => 'decimal:2',
'import_tax_percent' => 'decimal:2',
'import_tax' => 'decimal:2',
'price_with_tax' => 'decimal:2',
'profit_margin_percent' => 'decimal:2',
'final_unit_price' => 'decimal:2',
'quantity_leader' => 'decimal:2',
'total_leader' => 'decimal:2',
'total' => 'decimal:2',
'unit_weight_kg' => 'decimal:3',
'total_weight_kg' => 'decimal:3',
'gross_weight_kg' => 'decimal:3',
'shipping_fee_per_kg' => 'decimal:2',
'total_shipping_cost' => 'decimal:2',
'customs_fee' => 'decimal:2',
'other_fee' => 'decimal:2',
'total_cost' => 'decimal:2',
];
}
public function quoteRequest(): BelongsTo
{
return $this->belongsTo(QuoteRequest::class);
}
public function brand(): BelongsTo
{
return $this->belongsTo(Brand::class);
}
public function inter(): BelongsTo
{
return $this->belongsTo(Admin::class, 'inter_id');
}
}