feat: implement VM snapshot management, enhance client resource loading, and refactor deployment workflow for production

This commit is contained in:
pbao9
2026-05-11 11:09:55 +07:00
parent 8aef607e1f
commit 96778e7bed
51 changed files with 2536 additions and 1249 deletions
+8 -9
View File
@@ -1,16 +1,13 @@
<?php
use App\Repositories\Setting\SettingCachedRepository;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
if (!function_exists('setting')) {
function setting(string $key = '')
{
// Cách gọi setting('setting') để lấy toàn bộ group json
$repo = app()->make(\App\Repositories\Setting\SettingCachedRepository::class);
// Nếu có dấu chấm => lấy theo group
if (Str::contains($key, '.')) {
[$group, $subKey] = explode('.', $key, 2);
$groupData = $repo->getByKey($group);
@@ -30,26 +27,28 @@ if (!function_exists('setting')) {
if (!function_exists('format_price')) {
function format_price($price, $suffix = '₫')
{
if ($price === null)
if ($price === null) {
return '';
}
return number_format($price, 0, ',', '.') . ' ' . $suffix;
}
}
if (!function_exists('format_point')) {
function format_point($point, $suffix = '𝑝')
{
if ($point === null)
if ($point === null) {
return '';
}
return number_format($point, 0, ',', '.') . ' ' . $suffix;
}
}
if (!function_exists('format_day')) {
function format_day($date, $format = 'd/m/Y')
{
if (empty($date))
if (empty($date)) {
return '';
}
try {
return \Carbon\Carbon::parse($date)->format($format);
} catch (\Exception $e) {
@@ -83,7 +82,7 @@ if (!function_exists('generate_order_num')) {
function generate_order_num(string $prefix = 'TGS', int $length = 6): string
{
do {
$randomNumber = random_int(10 ** ($length - 1), (10 ** $length) - 1);
$randomNumber = random_int(10 ** ($length - 1), 10 ** $length - 1);
$orderNum = $prefix . $randomNumber;
} while (\App\Models\Order::where('order_num', $orderNum)->exists());
@@ -104,4 +103,4 @@ function is_active_route($path)
function show_class($path)
{
return request()->is(...(array) $path) ? 'show' : '';
}
}