fix profit value after each order 2

This commit is contained in:
2026-07-18 17:37:41 +03:30
parent b66cd5e8f9
commit 285a159762
8 changed files with 512 additions and 25 deletions
+16
View File
@@ -12,6 +12,7 @@ class Order extends Model
use HasFactory,Selector;
protected $fillable = [
'customer_id',
'product_id',
'sts',
'direction',
'amount',//میزان طلا
@@ -22,6 +23,10 @@ class Order extends Model
'total_price_original',//قیمت کل بدون سود
'fee',//سود هر گرم
'total_fee',//سود کل
'fee_source',//settings|product|app+product|none
'fee_source_key',//sell_fee|buy_fee|fee_single|cash_fee_sell|...
'fee_source_label',
'fee_breakdown',//فاکتور اقلام سود (JSON)
'service_charge_percentage',//درصد کارمزد
'service_charge',//میزان کارمزد
'service_charge_price',//مبلغ کارمزد به ریال
@@ -33,6 +38,11 @@ class Order extends Model
'pay_at',//تاریخ انجام معامله در پنل ادمین
'price_id',//
];
protected $casts = [
'fee_breakdown' => 'array',
];
static $STS = [
1 => 'باز',
2 => 'موفق',
@@ -58,6 +68,12 @@ class Order extends Model
public function customer(){
return $this->belongsTo(Customer::class);
}
public function product()
{
return $this->belongsTo(Product::class);
}
public function transactions(){
return $this->hasMany(Transaction::class);
}