Deploy Ladill Queue / deploy (push) Successful in 56s
Phases 1–6: tickets, counters, displays, appointments, workflows, rules, analytics, reports, feedback, admin, device API, and Gitea deploy workflow for queue.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
690 B
PHP
25 lines
690 B
PHP
<?php
|
|
|
|
namespace App\Support;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class DatabaseTime
|
|
{
|
|
public static function diffSeconds(string $fromColumn, string $toColumn): string
|
|
{
|
|
return match (DB::connection()->getDriverName()) {
|
|
'sqlite' => "CAST((julianday({$toColumn}) - julianday({$fromColumn})) * 86400 AS INTEGER)",
|
|
default => "TIMESTAMPDIFF(SECOND, {$fromColumn}, {$toColumn})",
|
|
};
|
|
}
|
|
|
|
public static function hourOf(string $column): string
|
|
{
|
|
return match (DB::connection()->getDriverName()) {
|
|
'sqlite' => "CAST(strftime('%H', {$column}) AS INTEGER)",
|
|
default => "HOUR({$column})",
|
|
};
|
|
}
|
|
}
|