Make quick sale products on machines as orders paid when ready

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-26 17:11:54 +02:00
co-authored by Claude Sonnet 5.5
parent 920fecdeb2
commit 38b8075a9c
58 changed files with 3435 additions and 26 deletions
@@ -0,0 +1,64 @@
<?php
namespace App\Modules\Sales\Infrastructure\Persistence\Eloquent;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Table;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Support\Carbon;
/**
* Persistence model, used only inside the Sales Infrastructure layer.
*
* @property int $id
* @property string $ordered_on Y-m-d
* @property int $pickup_number
* @property Carbon $ordered_at
* @property int $user_id
* @property int|null $customer_id
* @property string|null $customer_name
* @property string $status
* @property Carbon|null $made_at
* @property Carbon|null $paid_at
* @property Carbon|null $cancelled_at
* @property int|null $cancelled_by
*/
#[Table('quick_sale_orders')]
#[Fillable(['ordered_on', 'pickup_number', 'ordered_at', 'user_id', 'customer_id', 'customer_name', 'status', 'made_at', 'paid_at', 'cancelled_at', 'cancelled_by'])]
class QuickSaleOrderModel extends Model
{
/**
* @return HasMany<QuickSaleOrderLineModel, $this>
*/
public function lines(): HasMany
{
return $this->hasMany(QuickSaleOrderLineModel::class, 'quick_sale_order_id')->orderBy('sort_order');
}
/**
* @return HasOne<QuickSaleModel, $this>
*/
public function sale(): HasOne
{
return $this->hasOne(QuickSaleModel::class, 'quick_sale_order_id')->whereNull('credits_quick_sale_id');
}
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'pickup_number' => 'integer',
'ordered_at' => 'immutable_datetime',
'user_id' => 'integer',
'customer_id' => 'integer',
'made_at' => 'immutable_datetime',
'paid_at' => 'immutable_datetime',
'cancelled_at' => 'immutable_datetime',
'cancelled_by' => 'integer',
];
}
}