qr_code_batches + qr_codes tables. State machine via
spatie/laravel-model-states (unassigned → allocated → active → used,
plus expired/voided). Serial format PH-{area}-{YYMM}-{batch}-{code}-
{checksum} with 2-char SHA-256-derived checksum. BatchGenerator
bulk-inserts in chunks. QrAllocator allocates free codes to verified
households (prefers area-targeted batch, falls back to any). Real
HouseholdVerified listener replaces the placeholder. QrBalanceLow
event for Module 11.
Admin: batch CRUD, mark-printed, void code, lifecycle search, PDF
print sheet (24/A4 via dompdf + endroid/qr-code + picqer/barcode).
Resident: list own codes, balance with low_balance flag, activate
allocated codes.
Removed explicit Event::listen for HouseholdVerified — Laravel 11
auto-discovers it via handle() type-hint, and double-registering was
causing double-dispatch.
130 feature tests passing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Services\Sms\FakeSmsService;
|
|
use App\Services\Sms\LogSmsService;
|
|
use App\Services\Sms\SemaphoreSmsService;
|
|
use App\Services\Sms\SmsService;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
$this->app->singleton(SmsService::class, function ($app) {
|
|
$driver = config('services.sms.driver', 'log');
|
|
|
|
return match ($driver) {
|
|
'semaphore' => new SemaphoreSmsService(
|
|
apiKey: (string) config('services.semaphore.api_key'),
|
|
senderName: (string) config('services.semaphore.sender_name', 'VERDE'),
|
|
),
|
|
'fake' => new FakeSmsService(),
|
|
default => new LogSmsService(),
|
|
};
|
|
});
|
|
}
|
|
|
|
public function boot(): void
|
|
{
|
|
// Listeners under App\Listeners are auto-discovered by Laravel 11
|
|
// based on their handle() method's type-hint. Don't register them
|
|
// explicitly here — that causes double-dispatch.
|
|
}
|
|
}
|