- setting.require_complete_profile (mặc định bật), trả qua GET v1/setting - bulkDeleteServices xoá mềm invoice nâng cấp + order mồ côi (ServiceOrderRecorder::discardOrder) - createService trỏ dịch vụ sang order mới thì bỏ order cũ - SyncVirtualMachine cập nhật name + gắn virtual_machine_id cho module_vmware Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
87 lines
2.5 KiB
PHP
87 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\Setting;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\PopupBanner;
|
|
use App\Models\Setting;
|
|
use App\Support\ClientMenu;
|
|
use App\Support\ClientQuickLinks;
|
|
use App\Support\PublicSetting;
|
|
use App\Support\Turnstile;
|
|
|
|
/**
|
|
* @OA\Tag(
|
|
* name="Settings",
|
|
* description="API Endpoints for Application Settings"
|
|
* )
|
|
*/
|
|
class SettingController extends Controller
|
|
{
|
|
/**
|
|
* @OA\Get(
|
|
* path="/setting",
|
|
* operationId="getSetting",
|
|
* tags={"Settings"},
|
|
* summary="Get application settings",
|
|
* description="Returns the public application settings (title, company, logo, favi_icon, brand_color, require_complete_profile)",
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="Successful operation",
|
|
* @OA\JsonContent(
|
|
* @OA\Property(property="data", type="object"),
|
|
* @OA\Property(property="message", type="string", example="Get setting successfully"),
|
|
* @OA\Property(property="error", type="boolean", example=false)
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function getSetting(): \Illuminate\Http\JsonResponse
|
|
{
|
|
return response()->json([
|
|
'data' => PublicSetting::values() + [
|
|
'require_complete_profile' => PublicSetting::requireCompleteProfile(),
|
|
],
|
|
'message' => 'Get setting successfully',
|
|
'error' => false
|
|
]);
|
|
}
|
|
|
|
public function getEmailSetting(): \Illuminate\Http\JsonResponse
|
|
{
|
|
$setting = Setting::where('key', 'email_settings')->first();
|
|
$value = $setting ? json_decode($setting->value, true) : [];
|
|
|
|
return response()->json([
|
|
'error' => false,
|
|
'data' => [
|
|
'mail_enabled' => $value['mail_enabled'] ?? true,
|
|
],
|
|
]);
|
|
}
|
|
|
|
public function getTurnstileSetting(): \Illuminate\Http\JsonResponse
|
|
{
|
|
return response()->json([
|
|
'error' => false,
|
|
'data' => ['site_key' => Turnstile::siteKey()],
|
|
]);
|
|
}
|
|
|
|
public function getMenu(): \Illuminate\Http\JsonResponse
|
|
{
|
|
return response()->json([
|
|
'error' => false,
|
|
'data' => [
|
|
'items' => ClientMenu::items(),
|
|
'quick_links' => ClientQuickLinks::items(),
|
|
],
|
|
]);
|
|
}
|
|
|
|
public function getPopups(): \Illuminate\Http\JsonResponse
|
|
{
|
|
return response()->json(['error' => false, 'data' => PopupBanner::publicList()]);
|
|
}
|
|
}
|