Compare commits
3
Commits
9be2aa3468
..
0.0.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a58647a67d | ||
|
|
47bed5a5ab | ||
|
|
bac9b0a1e5 |
@@ -90,6 +90,8 @@ LAVERIE_BOOKING_PENALTY_AMOUNT=3.00
|
||||
|
||||
# Machines
|
||||
LAVERIE_MACHINE_OFFLINE_THRESHOLD_MINUTES=10
|
||||
# Désactiver le passage automatique en hors ligne (démo / dev sans matériel)
|
||||
LAVERIE_MACHINE_OFFLINE_CHECK_ENABLED=false
|
||||
|
||||
# Paiements
|
||||
LAVERIE_PAYMENT_PROVIDER=stripe
|
||||
|
||||
@@ -89,6 +89,10 @@ class MachinePageController extends Controller
|
||||
$validated['qr_code'] = $this->resolveQrCode($validated['qr_code'] ?? null);
|
||||
$validated['status'] = $validated['status'] ?? 'available';
|
||||
|
||||
if ($validated['status'] === 'available') {
|
||||
$validated['last_heartbeat_at'] = now();
|
||||
}
|
||||
|
||||
$machine = Machine::query()->create($validated);
|
||||
$this->createSimulatedIntegration($machine);
|
||||
|
||||
@@ -108,6 +112,14 @@ class MachinePageController extends Controller
|
||||
unset($validated['qr_code']);
|
||||
}
|
||||
|
||||
if (
|
||||
array_key_exists('status', $validated)
|
||||
&& $validated['status'] === 'available'
|
||||
&& $machine->status !== 'available'
|
||||
) {
|
||||
$validated['last_heartbeat_at'] = now();
|
||||
}
|
||||
|
||||
$machine->update($validated);
|
||||
|
||||
return redirect()->route('supervisor.machines.index')
|
||||
|
||||
@@ -15,6 +15,10 @@ class RefreshOfflineMachines implements ShouldQueue
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
if (! config('laverie.machine.offline_check_enabled', true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$thresholdMinutes = (int) config('laverie.machine.offline_threshold_minutes', 10);
|
||||
$cutoff = now()->subMinutes($thresholdMinutes);
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
"description": "The skeleton application for the Laravel framework.",
|
||||
"keywords": ["laravel", "framework"],
|
||||
"license": "MIT",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.3",
|
||||
"require": {
|
||||
"php": "^8.3",
|
||||
"inertiajs/inertia-laravel": "^2.0",
|
||||
|
||||
@@ -16,6 +16,10 @@ return [
|
||||
|
||||
'machine' => [
|
||||
'offline_threshold_minutes' => (int) env('LAVERIE_MACHINE_OFFLINE_THRESHOLD_MINUTES', 10),
|
||||
'offline_check_enabled' => filter_var(
|
||||
env('LAVERIE_MACHINE_OFFLINE_CHECK_ENABLED', true),
|
||||
FILTER_VALIDATE_BOOL
|
||||
),
|
||||
],
|
||||
|
||||
'payment' => [
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"$schema": "https://www.schemastore.org/package.json",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.3",
|
||||
"scripts": {
|
||||
"prod": "vite build",
|
||||
"dev": "vite"
|
||||
|
||||
Reference in New Issue
Block a user