Files
boursecu_server/app/Models/Order.php
T

86 lines
2.5 KiB
PHP
Raw Normal View History

2026-01-24 14:03:11 +00:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Rooyesh\Wallet\models\Transaction;
class Order extends Model
{
use HasFactory,Selector;
protected $fillable = [
'customer_id',
2026-07-18 17:37:41 +03:30
'product_id',
2026-01-24 14:03:11 +00:00
'sts',
'direction',
'amount',//میزان طلا
'price',//قیمت هر گرم طلا برای مشتری
'total_price',//قیمت کل برای مشتری
'price_original',//قیمت هر گرم طلا بدون سود
'total_price_liman',//قیمت هر گرم طلا بدون سود
'total_price_original',//قیمت کل بدون سود
'fee',//سود هر گرم
'total_fee',//سود کل
2026-07-18 17:37:41 +03:30
'fee_source',//settings|product|app+product|none
2026-07-28 10:33:11 +03:30
'fee_source_key',//sell_fee|buy_fee|cash_fee_sell|...
2026-07-18 17:37:41 +03:30
'fee_source_label',
'fee_breakdown',//فاکتور اقلام سود (JSON)
2026-01-24 14:03:11 +00:00
'service_charge_percentage',//درصد کارمزد
'service_charge',//میزان کارمزد
'service_charge_price',//مبلغ کارمزد به ریال
2026-07-10 23:29:36 +03:30
'fee_asset',//سمت کسر کارمزد: gold یا rial
2026-01-24 14:03:11 +00:00
'payment_sts',
'payment_amount',//میزان پرداخت شده
'payment_remind',//میزان مبلغ باقی مانده
'type',//نوع مشتری
'pay_at',//تاریخ انجام معامله در پنل ادمین
'price_id',//
'provider_id',
'total_price_montzar',
'description',
2026-01-24 14:03:11 +00:00
];
2026-07-18 17:37:41 +03:30
protected $casts = [
'fee_breakdown' => 'array',
];
2026-01-24 14:03:11 +00:00
static $STS = [
1 => 'باز',
2 => 'موفق',
3 => 'ناموفق',
4 => 'در انتظار همکار',
2026-01-24 14:03:11 +00:00
];
static $DIRECTION = [
1 => 'خرید',
2 => 'فروش'
];
static $PAYMENT_STS=[
1 => 'در انتظار پرداخت',
2 => 'در حال پرداخت',
3 => 'partially_paid',
4 => 'پرداخت شده',
5 => 'partially_refunded',
6 => 'مرجوعی',
7 => 'پرداخت نشده',
];
static $TYPE = [
1=>'همکار',
2=>'خانگی'
];
public function customer(){
return $this->belongsTo(Customer::class);
}
2026-07-18 17:37:41 +03:30
public function product()
{
return $this->belongsTo(Product::class);
}
2026-01-24 14:03:11 +00:00
public function transactions(){
return $this->hasMany(Transaction::class);
}
}