Deploy Ladill Events / deploy (push) Successful in 29s
Ticket and contribution checkouts use platform Pay for fees and wallet settlement, with legacy QREP-* fallback via Billing. Co-authored-by: Cursor <cursoragent@cursor.com>
63 lines
1.4 KiB
PHP
63 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class QrEventRegistration extends Model
|
|
{
|
|
public const STATUS_PENDING = 'pending';
|
|
public const STATUS_CONFIRMED = 'confirmed';
|
|
public const STATUS_FAILED = 'failed';
|
|
public const STATUS_CANCELLED = 'cancelled';
|
|
|
|
protected $fillable = [
|
|
'pay_order_id',
|
|
'qr_code_id',
|
|
'user_id',
|
|
'reference',
|
|
'badge_code',
|
|
'tier_name',
|
|
'amount_minor',
|
|
'currency',
|
|
'attendee_name',
|
|
'attendee_email',
|
|
'attendee_phone',
|
|
'badge_fields',
|
|
'status',
|
|
'payment_reference',
|
|
'paid_at',
|
|
'checked_in_at',
|
|
'metadata',
|
|
];
|
|
|
|
protected $casts = [
|
|
'badge_fields' => 'array',
|
|
'metadata' => 'array',
|
|
'amount_minor' => 'integer',
|
|
'paid_at' => 'datetime',
|
|
'checked_in_at' => 'datetime',
|
|
];
|
|
|
|
public function qrCode(): BelongsTo
|
|
{
|
|
return $this->belongsTo(QrCode::class);
|
|
}
|
|
|
|
public function organizer(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
|
|
public function amountCedis(): float
|
|
{
|
|
return round($this->amount_minor / 100, 2);
|
|
}
|
|
|
|
public function isPaid(): bool
|
|
{
|
|
return $this->amount_minor > 0;
|
|
}
|
|
}
|