Shop, menu, and booking storefronts with OIDC SSO, Pay checkout, and merchant.ladill.com deployment workflow. Co-authored-by: Cursor <cursoragent@cursor.com>
76 lines
2.1 KiB
PHP
76 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class QrBooking extends Model
|
|
{
|
|
public const STATUS_PENDING = 'pending';
|
|
public const STATUS_CONFIRMED = 'confirmed';
|
|
public const STATUS_CANCELLED = 'cancelled';
|
|
public const STATUS_FAILED = 'failed';
|
|
|
|
public const FULFILLMENT_NEW = 'new';
|
|
public const FULFILLMENT_CONFIRMED = 'confirmed';
|
|
public const FULFILLMENT_COMPLETED = 'completed';
|
|
public const FULFILLMENT_NO_SHOW = 'no_show';
|
|
public const FULFILLMENT_CANCELLED = 'cancelled';
|
|
|
|
public const FULFILLMENT_STATUSES = [
|
|
self::FULFILLMENT_NEW => 'New',
|
|
self::FULFILLMENT_CONFIRMED => 'Confirmed',
|
|
self::FULFILLMENT_COMPLETED => 'Completed',
|
|
self::FULFILLMENT_NO_SHOW => 'No show',
|
|
self::FULFILLMENT_CANCELLED => 'Cancelled',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'pay_order_id',
|
|
'qr_code_id',
|
|
'user_id',
|
|
'customer_name',
|
|
'customer_email',
|
|
'customer_phone',
|
|
'service_name',
|
|
'duration_minutes',
|
|
'starts_at',
|
|
'ends_at',
|
|
'amount_ghs',
|
|
'platform_fee_ghs',
|
|
'merchant_amount_ghs',
|
|
'status',
|
|
'fulfillment_status',
|
|
'payment_reference',
|
|
'paid_at',
|
|
'metadata',
|
|
];
|
|
|
|
protected $casts = [
|
|
'starts_at' => 'datetime',
|
|
'ends_at' => 'datetime',
|
|
'paid_at' => 'datetime',
|
|
'amount_ghs' => 'decimal:2',
|
|
'platform_fee_ghs' => 'decimal:2',
|
|
'merchant_amount_ghs' => 'decimal:2',
|
|
'metadata' => 'array',
|
|
'duration_minutes' => 'integer',
|
|
];
|
|
|
|
public function fulfillmentLabel(): string
|
|
{
|
|
return self::FULFILLMENT_STATUSES[$this->fulfillment_status ?? self::FULFILLMENT_NEW] ?? ucfirst((string) $this->fulfillment_status);
|
|
}
|
|
|
|
public function qrCode(): BelongsTo
|
|
{
|
|
return $this->belongsTo(QrCode::class);
|
|
}
|
|
|
|
public function merchant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
}
|