2026-11-16 20:19:31 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use App\Casts\UtcDatetimeCast;
|
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
|
|
|
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2026-11-17 12:15:34 +01:00
|
|
|
use Shared\Helpers\UuidHelper;
|
2026-11-16 20:19:31 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @property string $id
|
|
|
|
|
* @property string|null $customer_id
|
|
|
|
|
* @property string|null $order_id
|
|
|
|
|
* @property \Illuminate\Support\Carbon|null $converted_at
|
|
|
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
|
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
|
|
|
* @property-read \App\Models\Customer|null $customer
|
|
|
|
|
* @property-read \App\Models\Order|null $order
|
|
|
|
|
*
|
|
|
|
|
* @mixin \Eloquent
|
|
|
|
|
*/
|
|
|
|
|
#[Fillable([
|
|
|
|
|
'customer_id',
|
|
|
|
|
'order_id',
|
|
|
|
|
'converted_at',
|
|
|
|
|
])]
|
|
|
|
|
class OrderTunnelAttempt extends Model
|
|
|
|
|
{
|
|
|
|
|
use HasUuids;
|
|
|
|
|
|
|
|
|
|
public function newUniqueId(): string
|
|
|
|
|
{
|
2026-11-17 12:15:34 +01:00
|
|
|
return UuidHelper::v7()->toString();
|
2026-11-16 20:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return BelongsTo<Customer, $this>
|
|
|
|
|
*/
|
|
|
|
|
public function customer(): BelongsTo
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Customer::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return BelongsTo<Order, $this>
|
|
|
|
|
*/
|
|
|
|
|
public function order(): BelongsTo
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Order::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[\Override]
|
|
|
|
|
protected function casts(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'converted_at' => UtcDatetimeCast::class,
|
|
|
|
|
'created_at' => UtcDatetimeCast::class,
|
|
|
|
|
'updated_at' => UtcDatetimeCast::class,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|