style: Laravel Pint 코드 포맷팅 적용
- PSR-12 스타일 가이드 준수 - 302개 파일 스타일 이슈 자동 수정 - 코드 로직 변경 없음 (포맷팅만)
This commit is contained in:
@@ -2,12 +2,11 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
use App\Models\Tenants\TenantFieldSetting;
|
||||
use App\Models\Tenants\TenantOptionGroup;
|
||||
use App\Models\Tenants\TenantOptionValue;
|
||||
use App\Models\Tenants\TenantFieldSetting;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class TenantOptionGroupService
|
||||
{
|
||||
@@ -24,16 +23,16 @@ protected static function tenantId(): ?int
|
||||
public static function index(array $params = [])
|
||||
{
|
||||
$tenantId = self::tenantId();
|
||||
if (!$tenantId) {
|
||||
if (! $tenantId) {
|
||||
return ['error' => '활성 테넌트가 없습니다.', 'code' => 400];
|
||||
}
|
||||
|
||||
$per = (int)($params['per_page'] ?? $params['size'] ?? 20);
|
||||
$page = isset($params['page']) ? (int)$params['page'] : null;
|
||||
$per = (int) ($params['per_page'] ?? $params['size'] ?? 20);
|
||||
$page = isset($params['page']) ? (int) $params['page'] : null;
|
||||
|
||||
$q = TenantOptionGroup::where('tenant_id', $tenantId)->orderBy('group_key');
|
||||
|
||||
if (!empty($params['q'])) {
|
||||
if (! empty($params['q'])) {
|
||||
$kw = $params['q'];
|
||||
$q->where(function ($w) use ($kw) {
|
||||
$w->where('group_key', 'like', "%{$kw}%")
|
||||
@@ -52,18 +51,18 @@ public static function index(array $params = [])
|
||||
public static function store(array $params = [])
|
||||
{
|
||||
$tenantId = self::tenantId();
|
||||
if (!$tenantId) {
|
||||
if (! $tenantId) {
|
||||
return ['error' => '활성 테넌트가 없습니다.', 'code' => 400];
|
||||
}
|
||||
|
||||
$v = Validator::make($params, [
|
||||
'group_key' => [
|
||||
'required','string','max:64','alpha_dash',
|
||||
'required', 'string', 'max:64', 'alpha_dash',
|
||||
Rule::unique('tenant_option_groups', 'group_key')
|
||||
->where(fn ($q) => $q->where('tenant_id', $tenantId)),
|
||||
],
|
||||
'name' => ['required','string','max:100'],
|
||||
'description' => ['nullable','string','max:255'],
|
||||
'name' => ['required', 'string', 'max:100'],
|
||||
'description' => ['nullable', 'string', 'max:255'],
|
||||
]);
|
||||
|
||||
if ($v->fails()) {
|
||||
@@ -84,15 +83,15 @@ public static function store(array $params = [])
|
||||
public static function show(int $id)
|
||||
{
|
||||
$tenantId = self::tenantId();
|
||||
if (!$tenantId) {
|
||||
if (! $tenantId) {
|
||||
return ['error' => '활성 테넌트가 없습니다.', 'code' => 400];
|
||||
}
|
||||
if (!$id) {
|
||||
if (! $id) {
|
||||
return ['error' => 'id가 올바르지 않습니다.', 'code' => 422];
|
||||
}
|
||||
|
||||
$item = TenantOptionGroup::where('tenant_id', $tenantId)->find($id);
|
||||
if (!$item) {
|
||||
if (! $item) {
|
||||
return ['error' => '옵션 그룹을 찾을 수 없습니다.', 'code' => 404];
|
||||
}
|
||||
|
||||
@@ -105,27 +104,27 @@ public static function show(int $id)
|
||||
public static function update(int $id, array $params = [])
|
||||
{
|
||||
$tenantId = self::tenantId();
|
||||
if (!$tenantId) {
|
||||
if (! $tenantId) {
|
||||
return ['error' => '활성 테넌트가 없습니다.', 'code' => 400];
|
||||
}
|
||||
if (!$id) {
|
||||
if (! $id) {
|
||||
return ['error' => 'id가 올바르지 않습니다.', 'code' => 422];
|
||||
}
|
||||
|
||||
$item = TenantOptionGroup::where('tenant_id', $tenantId)->find($id);
|
||||
if (!$item) {
|
||||
if (! $item) {
|
||||
return ['error' => '옵션 그룹을 찾을 수 없습니다.', 'code' => 404];
|
||||
}
|
||||
|
||||
$v = Validator::make($params, [
|
||||
'group_key' => [
|
||||
'sometimes','string','max:64','alpha_dash',
|
||||
'sometimes', 'string', 'max:64', 'alpha_dash',
|
||||
Rule::unique('tenant_option_groups', 'group_key')
|
||||
->where(fn ($q) => $q->where('tenant_id', $tenantId))
|
||||
->ignore($item->id),
|
||||
],
|
||||
'name' => ['sometimes','string','max:100'],
|
||||
'description' => ['nullable','string','max:255'],
|
||||
'name' => ['sometimes', 'string', 'max:100'],
|
||||
'description' => ['nullable', 'string', 'max:255'],
|
||||
]);
|
||||
|
||||
if ($v->fails()) {
|
||||
@@ -151,15 +150,15 @@ public static function update(int $id, array $params = [])
|
||||
public static function destroy(int $id)
|
||||
{
|
||||
$tenantId = self::tenantId();
|
||||
if (!$tenantId) {
|
||||
if (! $tenantId) {
|
||||
return ['error' => '활성 테넌트가 없습니다.', 'code' => 400];
|
||||
}
|
||||
if (!$id) {
|
||||
if (! $id) {
|
||||
return ['error' => 'id가 올바르지 않습니다.', 'code' => 422];
|
||||
}
|
||||
|
||||
$item = TenantOptionGroup::where('tenant_id', $tenantId)->find($id);
|
||||
if (!$item) {
|
||||
if (! $item) {
|
||||
return ['error' => '옵션 그룹을 찾을 수 없습니다.', 'code' => 404];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user