ekart/backend/app/Models/Payment.php
kusowl 2aa76db042 feature: implement payment gateway
- implement stripe checkout gateway
- add payment gateway factory and service
2026-03-23 17:29:24 +05:30

41 lines
823 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @mixin IdeHelperPayment
*/
class Payment extends Model
{
protected $fillable = [
'order_id',
'transaction_id',
'amount',
'currency',
'payment_method',
'payment_status_id',
'error_message',
];
protected $with = ['paymentStatus'];
public function order(): BelongsTo
{
return $this->belongsTo(Order::class);
}
public function paymentStatus(): BelongsTo
{
return $this->belongsTo(PaymentStatus::class);
}
protected function status(): Attribute
{
return Attribute::make(fn () => $this->paymentStatus?->name);
}
}