getDriverName() === 'sqlite'; } /** * Day-of-week expression returning 1=Sun..7=Sat (MySQL DAYOFWEEK convention). * Targets a column on the queried table. */ public static function dayOfWeekExpr(string $column): string { return self::isSqlite() ? "(CAST(strftime('%w', {$column}) AS INTEGER) + 1)" : "DAYOFWEEK({$column})"; } /** * Whole-day difference between MAX and MIN of a datetime column, suitable * for use in an aggregate selectRaw. */ public static function maxMinDayDiffExpr(string $column): string { return self::isSqlite() ? "CAST((julianday(MAX({$column})) - julianday(MIN({$column}))) AS INTEGER)" : "DATEDIFF(MAX({$column}), MIN({$column}))"; } }