style: Laravel Pint 코드 포맷팅 적용
- PSR-12 스타일 가이드 준수 - 302개 파일 스타일 이슈 자동 수정 - 코드 로직 변경 없음 (포맷팅만)
This commit is contained in:
@@ -2,13 +2,12 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Tenants\TenantOptionGroup;
|
||||
use App\Models\Tenants\TenantOptionValue;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
use App\Models\Tenants\TenantOptionGroup;
|
||||
use App\Models\Tenants\TenantOptionValue;
|
||||
|
||||
class TenantOptionValueService
|
||||
{
|
||||
/** 활성 테넌트 ID */
|
||||
@@ -30,12 +29,12 @@ protected static function loadGroup(int $tenantId, int $groupId): ?TenantOptionG
|
||||
public static function index(int $groupId, array $params = [])
|
||||
{
|
||||
$tenantId = self::tenantId();
|
||||
if (!$tenantId) {
|
||||
if (! $tenantId) {
|
||||
return ['error' => '활성 테넌트가 없습니다.', 'code' => 400];
|
||||
}
|
||||
|
||||
$group = self::loadGroup($tenantId, $groupId);
|
||||
if (!$group) {
|
||||
if (! $group) {
|
||||
return ['error' => '옵션 그룹을 찾을 수 없습니다.', 'code' => 404];
|
||||
}
|
||||
|
||||
@@ -43,7 +42,7 @@ public static function index(int $groupId, array $params = [])
|
||||
->orderBy('sort_order')
|
||||
->orderBy('value_label');
|
||||
|
||||
if (!empty($params['active_only'])) {
|
||||
if (! empty($params['active_only'])) {
|
||||
$q->where('is_active', 1);
|
||||
}
|
||||
|
||||
@@ -58,24 +57,24 @@ public static function index(int $groupId, array $params = [])
|
||||
public static function store(int $groupId, array $params = [])
|
||||
{
|
||||
$tenantId = self::tenantId();
|
||||
if (!$tenantId) {
|
||||
if (! $tenantId) {
|
||||
return ['error' => '활성 테넌트가 없습니다.', 'code' => 400];
|
||||
}
|
||||
|
||||
$group = self::loadGroup($tenantId, $groupId);
|
||||
if (!$group) {
|
||||
if (! $group) {
|
||||
return ['error' => '옵션 그룹을 찾을 수 없습니다.', 'code' => 404];
|
||||
}
|
||||
|
||||
$v = Validator::make($params, [
|
||||
'value_key' => [
|
||||
'required','string','max:64','alpha_dash',
|
||||
'value_key' => [
|
||||
'required', 'string', 'max:64', 'alpha_dash',
|
||||
Rule::unique('tenant_option_values', 'value_key')
|
||||
->where(fn ($q) => $q->where('group_id', $group->id)),
|
||||
],
|
||||
'value_label' => ['required','string','max:100'],
|
||||
'sort_order' => ['nullable','integer'],
|
||||
'is_active' => ['nullable','boolean'],
|
||||
'value_label' => ['required', 'string', 'max:100'],
|
||||
'sort_order' => ['nullable', 'integer'],
|
||||
'is_active' => ['nullable', 'boolean'],
|
||||
]);
|
||||
|
||||
if ($v->fails()) {
|
||||
@@ -95,17 +94,17 @@ public static function store(int $groupId, array $params = [])
|
||||
public static function show(int $groupId, int $id)
|
||||
{
|
||||
$tenantId = self::tenantId();
|
||||
if (!$tenantId) {
|
||||
if (! $tenantId) {
|
||||
return ['error' => '활성 테넌트가 없습니다.', 'code' => 400];
|
||||
}
|
||||
|
||||
$group = self::loadGroup($tenantId, $groupId);
|
||||
if (!$group) {
|
||||
if (! $group) {
|
||||
return ['error' => '옵션 그룹을 찾을 수 없습니다.', 'code' => 404];
|
||||
}
|
||||
|
||||
$item = TenantOptionValue::where('group_id', $group->id)->find($id);
|
||||
if (!$item) {
|
||||
if (! $item) {
|
||||
return ['error' => '옵션 값을 찾을 수 없습니다.', 'code' => 404];
|
||||
}
|
||||
|
||||
@@ -118,30 +117,30 @@ public static function show(int $groupId, int $id)
|
||||
public static function update(int $groupId, int $id, array $params = [])
|
||||
{
|
||||
$tenantId = self::tenantId();
|
||||
if (!$tenantId) {
|
||||
if (! $tenantId) {
|
||||
return ['error' => '활성 테넌트가 없습니다.', 'code' => 400];
|
||||
}
|
||||
|
||||
$group = self::loadGroup($tenantId, $groupId);
|
||||
if (!$group) {
|
||||
if (! $group) {
|
||||
return ['error' => '옵션 그룹을 찾을 수 없습니다.', 'code' => 404];
|
||||
}
|
||||
|
||||
$item = TenantOptionValue::where('group_id', $group->id)->find($id);
|
||||
if (!$item) {
|
||||
if (! $item) {
|
||||
return ['error' => '옵션 값을 찾을 수 없습니다.', 'code' => 404];
|
||||
}
|
||||
|
||||
$v = Validator::make($params, [
|
||||
'value_key' => [
|
||||
'sometimes','string','max:64','alpha_dash',
|
||||
'value_key' => [
|
||||
'sometimes', 'string', 'max:64', 'alpha_dash',
|
||||
Rule::unique('tenant_option_values', 'value_key')
|
||||
->where(fn ($q) => $q->where('group_id', $group->id))
|
||||
->ignore($item->id),
|
||||
],
|
||||
'value_label' => ['sometimes','string','max:100'],
|
||||
'sort_order' => ['nullable','integer'],
|
||||
'is_active' => ['nullable','boolean'],
|
||||
'value_label' => ['sometimes', 'string', 'max:100'],
|
||||
'sort_order' => ['nullable', 'integer'],
|
||||
'is_active' => ['nullable', 'boolean'],
|
||||
]);
|
||||
|
||||
if ($v->fails()) {
|
||||
@@ -165,17 +164,17 @@ public static function update(int $groupId, int $id, array $params = [])
|
||||
public static function destroy(int $groupId, int $id)
|
||||
{
|
||||
$tenantId = self::tenantId();
|
||||
if (!$tenantId) {
|
||||
if (! $tenantId) {
|
||||
return ['error' => '활성 테넌트가 없습니다.', 'code' => 400];
|
||||
}
|
||||
|
||||
$group = self::loadGroup($tenantId, $groupId);
|
||||
if (!$group) {
|
||||
if (! $group) {
|
||||
return ['error' => '옵션 그룹을 찾을 수 없습니다.', 'code' => 404];
|
||||
}
|
||||
|
||||
$item = TenantOptionValue::where('group_id', $group->id)->find($id);
|
||||
if (!$item) {
|
||||
if (! $item) {
|
||||
return ['error' => '옵션 값을 찾을 수 없습니다.', 'code' => 404];
|
||||
}
|
||||
|
||||
@@ -192,19 +191,19 @@ public static function destroy(int $groupId, int $id)
|
||||
public static function reorder(int $groupId, array $params = [])
|
||||
{
|
||||
$tenantId = self::tenantId();
|
||||
if (!$tenantId) {
|
||||
if (! $tenantId) {
|
||||
return ['error' => '활성 테넌트가 없습니다.', 'code' => 400];
|
||||
}
|
||||
|
||||
$group = self::loadGroup($tenantId, $groupId);
|
||||
if (!$group) {
|
||||
if (! $group) {
|
||||
return ['error' => '옵션 그룹을 찾을 수 없습니다.', 'code' => 404];
|
||||
}
|
||||
|
||||
$v = Validator::make($params, [
|
||||
'items' => ['required','array','min:1'],
|
||||
'items.*.id' => ['required','integer'],
|
||||
'items.*.sort_order' => ['required','integer'],
|
||||
'items' => ['required', 'array', 'min:1'],
|
||||
'items.*.id' => ['required', 'integer'],
|
||||
'items.*.sort_order' => ['required', 'integer'],
|
||||
]);
|
||||
|
||||
if ($v->fails()) {
|
||||
|
||||
Reference in New Issue
Block a user