feat: implement VM snapshot management, enhance client resource loading, and refactor deployment workflow for production
This commit is contained in:
@@ -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' : '';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user