style: Laravel Pint 코드 포맷팅 적용
- PSR-12 스타일 가이드 준수 - 302개 파일 스타일 이슈 자동 수정 - 코드 로직 변경 없음 (포맷팅만)
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
class GenerateSimpleRelationships extends Command
|
||||
{
|
||||
protected $signature = 'db:generate-simple-relationships';
|
||||
|
||||
protected $description = '기본 논리적 관계 문서 생성';
|
||||
|
||||
public function handle()
|
||||
@@ -29,7 +30,7 @@ private function getKnownRelationships(): array
|
||||
'user_tenants (hasMany)' => 'user_tenants.user_id → users.id',
|
||||
'user_roles (hasMany)' => 'user_roles.user_id → users.id',
|
||||
'audit_logs (hasMany)' => 'audit_logs.actor_id → users.id (생성자)',
|
||||
]
|
||||
],
|
||||
],
|
||||
'tenants' => [
|
||||
'description' => '테넌트 (회사/조직)',
|
||||
@@ -39,7 +40,7 @@ private function getKnownRelationships(): array
|
||||
'departments (hasMany)' => 'departments.tenant_id → tenants.id',
|
||||
'products (hasMany)' => 'products.tenant_id → tenants.id',
|
||||
'orders (hasMany)' => 'orders.tenant_id → tenants.id',
|
||||
]
|
||||
],
|
||||
],
|
||||
'categories' => [
|
||||
'description' => '제품 카테고리 (계층구조)',
|
||||
@@ -48,7 +49,7 @@ private function getKnownRelationships(): array
|
||||
'children (hasMany)' => 'categories.parent_id → categories.id',
|
||||
'products (hasMany)' => 'products.category_id → categories.id',
|
||||
'estimates (hasMany)' => 'estimates.model_set_id → categories.id (논리적)',
|
||||
]
|
||||
],
|
||||
],
|
||||
'products' => [
|
||||
'description' => '제품 마스터',
|
||||
@@ -57,7 +58,7 @@ private function getKnownRelationships(): array
|
||||
'tenant (belongsTo)' => 'products.tenant_id → tenants.id',
|
||||
'product_components (hasMany)' => 'product_components.parent_product_id → products.id (논리적)',
|
||||
'order_items (hasMany)' => 'order_items.product_id → products.id',
|
||||
]
|
||||
],
|
||||
],
|
||||
'departments' => [
|
||||
'description' => '부서 관리 (계층구조)',
|
||||
@@ -65,7 +66,7 @@ private function getKnownRelationships(): array
|
||||
'parent (belongsTo)' => 'departments.parent_id → departments.id (논리적)',
|
||||
'children (hasMany)' => 'departments.parent_id → departments.id (논리적)',
|
||||
'tenant (belongsTo)' => 'departments.tenant_id → tenants.id',
|
||||
]
|
||||
],
|
||||
],
|
||||
'estimates' => [
|
||||
'description' => '견적서 (스냅샷 데이터)',
|
||||
@@ -73,14 +74,14 @@ private function getKnownRelationships(): array
|
||||
'category (belongsTo)' => 'estimates.model_set_id → categories.id (논리적)',
|
||||
'tenant (belongsTo)' => 'estimates.tenant_id → tenants.id',
|
||||
'estimate_items (hasMany)' => 'estimate_items.estimate_id → estimates.id (논리적)',
|
||||
]
|
||||
],
|
||||
],
|
||||
'estimate_items' => [
|
||||
'description' => '견적 아이템',
|
||||
'relationships' => [
|
||||
'estimate (belongsTo)' => 'estimate_items.estimate_id → estimates.id (논리적)',
|
||||
'tenant (belongsTo)' => 'estimate_items.tenant_id → tenants.id',
|
||||
]
|
||||
],
|
||||
],
|
||||
'product_components' => [
|
||||
'description' => 'BOM 구성요소 (통합 참조구조)',
|
||||
@@ -88,13 +89,13 @@ private function getKnownRelationships(): array
|
||||
'parent_product (belongsTo)' => 'product_components.parent_product_id → products.id (논리적)',
|
||||
'material_or_product (polymorphic)' => 'product_components.ref_id → materials.id OR products.id (ref_type 기반)',
|
||||
'tenant (belongsTo)' => 'product_components.tenant_id → tenants.id',
|
||||
]
|
||||
],
|
||||
],
|
||||
'classifications' => [
|
||||
'description' => '분류 코드',
|
||||
'relationships' => [
|
||||
'tenant (belongsTo)' => 'classifications.tenant_id → tenants.id (논리적)',
|
||||
]
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class MakeModelWithRelationships extends Command
|
||||
{
|
||||
protected $signature = 'make:model-with-docs {name} {--migration} {--controller} {--resource}';
|
||||
|
||||
protected $description = '모델 생성 후 자동으로 관계 문서 업데이트';
|
||||
|
||||
public function handle()
|
||||
@@ -17,9 +18,15 @@ public function handle()
|
||||
|
||||
// 기본 모델 생성
|
||||
$options = [];
|
||||
if ($this->option('migration')) $options['--migration'] = true;
|
||||
if ($this->option('controller')) $options['--controller'] = true;
|
||||
if ($this->option('resource')) $options['--resource'] = true;
|
||||
if ($this->option('migration')) {
|
||||
$options['--migration'] = true;
|
||||
}
|
||||
if ($this->option('controller')) {
|
||||
$options['--controller'] = true;
|
||||
}
|
||||
if ($this->option('resource')) {
|
||||
$options['--resource'] = true;
|
||||
}
|
||||
|
||||
Artisan::call('make:model', array_merge(['name' => $modelName], $options));
|
||||
$this->info("✅ 모델 생성 완료: {$modelName}");
|
||||
@@ -38,6 +45,7 @@ private function addRelationshipTemplate(string $modelName): void
|
||||
|
||||
if (! File::exists($modelPath)) {
|
||||
$this->error("모델 파일을 찾을 수 없습니다: {$modelPath}");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class PruneAuditLogs extends Command
|
||||
{
|
||||
protected $signature = 'audit:prune {--days=}';
|
||||
|
||||
protected $description = 'Delete audit logs older than given days (default: config(audit.retention_days)).';
|
||||
|
||||
public function handle(): int
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Commons\Menu;
|
||||
use Illuminate\Console\Command;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\PermissionRegistrar;
|
||||
|
||||
class SeedMenuPermissions extends Command
|
||||
{
|
||||
protected $signature = 'sam:seed-menu-perms {--tenant=} {--guard=api}';
|
||||
|
||||
protected $description = 'Create missing permissions menu:{id}.{action} for all menus';
|
||||
|
||||
public function handle(): int
|
||||
@@ -39,6 +40,7 @@ public function handle(): int
|
||||
|
||||
app(PermissionRegistrar::class)->forgetCachedPermissions();
|
||||
$this->info("Ensured {$count} permissions.");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Services\TenantBootstrapper;
|
||||
use Illuminate\Console\Attributes\AsCommand;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Console\Attributes\AsCommand;
|
||||
|
||||
#[AsCommand(name: 'tenants:bootstrap', description: 'Bootstrap menus/capability/categories/settings for tenant(s)')]
|
||||
class TenantsBootstrap extends Command
|
||||
@@ -27,11 +27,13 @@ public function handle(TenantBootstrapper $svc): int
|
||||
$ids = [(int) $tenantId];
|
||||
} else {
|
||||
$this->error('Provide --tenant_id=ID or --all');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
if (empty($ids)) {
|
||||
$this->warn('No tenant to bootstrap.');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class UpdateLogicalRelationships extends Command
|
||||
{
|
||||
protected $signature = 'db:update-relationships';
|
||||
|
||||
protected $description = '모델에서 논리적 관계를 추출하여 문서 업데이트';
|
||||
|
||||
public function handle()
|
||||
@@ -30,10 +31,14 @@ private function extractModelRelationships(): array
|
||||
$modelFiles = File::allFiles($modelPath);
|
||||
|
||||
foreach ($modelFiles as $file) {
|
||||
if ($file->getExtension() !== 'php') continue;
|
||||
if ($file->getExtension() !== 'php') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$className = $this->getClassNameFromFile($file);
|
||||
if (!$className || !class_exists($className)) continue;
|
||||
if (! $className || ! class_exists($className)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$reflection = new ReflectionClass($className);
|
||||
@@ -50,15 +55,18 @@ private function extractModelRelationships(): array
|
||||
|
||||
// 테이블 이름 직접 추출
|
||||
$tableName = $this->getTableNameFromModel($className, $reflection);
|
||||
if (!$tableName) continue;
|
||||
if (! $tableName) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$relationships[$tableName] = [
|
||||
'model' => $className,
|
||||
'relationships' => $this->getModelRelationshipsFromFile($file, $className)
|
||||
'relationships' => $this->getModelRelationshipsFromFile($file, $className),
|
||||
];
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->warn("모델 분석 실패: {$className} - ".$e->getMessage());
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -112,8 +120,9 @@ private function getModelRelationshipsFromFile($file, string $className): array
|
||||
'type' => $type,
|
||||
'related_model' => '(Polymorphic)',
|
||||
'foreign_key' => null,
|
||||
'local_key' => null
|
||||
'local_key' => null,
|
||||
];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -128,7 +137,7 @@ private function getModelRelationshipsFromFile($file, string $className): array
|
||||
'type' => $type,
|
||||
'related_model' => $fullyQualifiedClass,
|
||||
'foreign_key' => null,
|
||||
'local_key' => null
|
||||
'local_key' => null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -223,7 +232,7 @@ private function getModelRelationships(ReflectionClass $reflection, $model): arr
|
||||
'type' => $this->getRelationshipType($result),
|
||||
'related_model' => get_class($result->getRelated()),
|
||||
'foreign_key' => $this->getForeignKey($result),
|
||||
'local_key' => $this->getLocalKey($result)
|
||||
'local_key' => $this->getLocalKey($result),
|
||||
];
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
@@ -243,6 +252,7 @@ private function isRelationshipMethod($result): bool
|
||||
private function getRelationshipType($relation): string
|
||||
{
|
||||
$className = get_class($relation);
|
||||
|
||||
return class_basename($className);
|
||||
}
|
||||
|
||||
@@ -287,7 +297,9 @@ private function updateLogicalDocument(array $relationships): void
|
||||
$content .= "## 📊 모델별 관계 현황\n\n";
|
||||
|
||||
foreach ($relationships as $tableName => $info) {
|
||||
if (empty($info['relationships'])) continue;
|
||||
if (empty($info['relationships'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$content .= "### {$tableName}\n";
|
||||
$content .= "**모델**: `{$info['model']}`\n\n";
|
||||
@@ -297,12 +309,14 @@ private function updateLogicalDocument(array $relationships): void
|
||||
// Polymorphic 관계는 특별 표시
|
||||
if ($rel['related_model'] === '(Polymorphic)') {
|
||||
$content .= "- **{$rel['method']}()**: {$rel['type']} → `(Polymorphic)`\n";
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// 관련 모델 클래스가 존재하는지 확인
|
||||
if (! class_exists($rel['related_model'])) {
|
||||
$this->warn("모델 클래스가 존재하지 않음: {$rel['related_model']}");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -316,6 +330,7 @@ private function updateLogicalDocument(array $relationships): void
|
||||
$content .= "\n";
|
||||
} catch (\Exception $e) {
|
||||
$this->warn("관계 처리 실패: {$rel['method']} - ".$e->getMessage());
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use App\Console\Commands\GenerateSimpleRelationships;
|
||||
use App\Console\Commands\MakeModelWithRelationships;
|
||||
use App\Console\Commands\PruneAuditLogs;
|
||||
use App\Console\Commands\UpdateLogicalRelationships;
|
||||
use App\Console\Commands\MakeModelWithRelationships;
|
||||
use App\Console\Commands\GenerateSimpleRelationships;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
@@ -11,7 +12,6 @@
|
||||
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Throwable;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
@@ -36,7 +36,9 @@ protected function sendSlackException(Throwable $e): void
|
||||
try {
|
||||
$url = env('LOG_SLACK_WEBHOOK_URL');
|
||||
|
||||
if (!$url) return;
|
||||
if (! $url) {
|
||||
return;
|
||||
}
|
||||
|
||||
$ip = request()?->ip() ?? 'N/A'; // 요청이 없는 경우 대비
|
||||
|
||||
@@ -44,8 +46,8 @@ protected function sendSlackException(Throwable $e): void
|
||||
'text' => "*[Laravel] 예외 발생!*\n".
|
||||
"• 메시지: `{$e->getMessage()}`\n".
|
||||
"• 위치: `{$e->getFile()}:{$e->getLine()}`\n".
|
||||
"• 시간: " . now()->toDateTimeString() . "\n" .
|
||||
"• IP: `{$ip}`"
|
||||
'• 시간: '.now()->toDateTimeString()."\n".
|
||||
"• IP: `{$ip}`",
|
||||
]);
|
||||
} catch (Throwable $ex) {
|
||||
logger()->error('슬랙 전송 실패', ['message' => $ex->getMessage()]);
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class ApiResponse
|
||||
{
|
||||
|
||||
function normalizeFiles(array $laravelFiles): array {
|
||||
public function normalizeFiles(array $laravelFiles): array
|
||||
{
|
||||
$files = ['name' => [], 'type' => [], 'tmp_name' => [], 'size' => [], 'fileType' => []];
|
||||
foreach ($laravelFiles as $file) {
|
||||
$files['name'][] = $file->getClientOriginalName();
|
||||
@@ -18,10 +18,11 @@ function normalizeFiles(array $laravelFiles): array {
|
||||
$files['size'][] = $file->getSize();
|
||||
$files['fileType'][] = '';
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
# DebugQuery Helper
|
||||
// DebugQuery Helper
|
||||
public static function debugQueryLog(): array
|
||||
{
|
||||
$logs = DB::getQueryLog();
|
||||
@@ -37,11 +38,12 @@ public static function debugQueryLog(): array
|
||||
|
||||
// \n 제거
|
||||
$query = str_replace(["\n", "\r"], ' ', $query)." (time: {$log['time']})";
|
||||
|
||||
return trim($query);
|
||||
})->toArray();
|
||||
}
|
||||
|
||||
# ApiResponse Helper
|
||||
// ApiResponse Helper
|
||||
public static function success(
|
||||
$data = null,
|
||||
string $message = '요청 성공',
|
||||
@@ -52,7 +54,10 @@ public static function success(
|
||||
'message' => $message,
|
||||
'data' => $data,
|
||||
];
|
||||
if(!empty($debug)) $response['query'] = $debug;
|
||||
if (! empty($debug)) {
|
||||
$response['query'] = $debug;
|
||||
}
|
||||
|
||||
return response()->json($response);
|
||||
}
|
||||
|
||||
@@ -118,8 +123,7 @@ public static function response($type = '', $query = '', $key = ''): array
|
||||
public static function handle(
|
||||
callable $callback,
|
||||
string $responseTitle = '요청'
|
||||
): JsonResponse
|
||||
{
|
||||
): JsonResponse {
|
||||
try {
|
||||
$result = $callback();
|
||||
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AdminService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Members\User;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -11,19 +10,15 @@
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
|
||||
class ApiController extends Controller
|
||||
{
|
||||
|
||||
|
||||
public function debugApikey()
|
||||
{
|
||||
$message = 'API Key 인증 성공';
|
||||
|
||||
return response()->json(['message' => $message]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function login(Request $request)
|
||||
{
|
||||
$userId = $request->input('user_id');
|
||||
@@ -33,7 +28,6 @@ public function login(Request $request)
|
||||
return response()->json(['error' => '아이디 또는 비밀번호 누락'], 400);
|
||||
}
|
||||
|
||||
|
||||
$user = User::where('user_id', $userId)->first();
|
||||
|
||||
if (! $user) {
|
||||
@@ -76,7 +70,6 @@ public function logout(Request $request)
|
||||
return response()->json(['message' => '로그아웃 완료']);
|
||||
}
|
||||
|
||||
|
||||
public function signup(Request $request)
|
||||
{
|
||||
// 신규 회원 생성 + 역할 부여 지원
|
||||
@@ -107,5 +100,4 @@ public function signup(Request $request)
|
||||
return ['user' => $user->only(['id', 'user_id', 'name', 'email', 'phone'])];
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\CategoryService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\CategoryFieldService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\CategoryFieldService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CategoryFieldController extends Controller
|
||||
{
|
||||
@@ -48,6 +48,7 @@ public function destroy(int $field)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($field) {
|
||||
$this->service->destroy($field);
|
||||
|
||||
return 'success';
|
||||
}, '카테고리 필드 삭제');
|
||||
}
|
||||
@@ -57,6 +58,7 @@ public function reorder(int $id, Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id, $request) {
|
||||
$this->service->reorder($id, $request->input());
|
||||
|
||||
return 'success';
|
||||
}, '카테고리 필드 정렬 저장');
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\CategoryLogService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\CategoryLogService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CategoryLogController extends Controller
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\CategoryTemplateService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\CategoryTemplateService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CategoryTemplateController extends Controller
|
||||
{
|
||||
@@ -48,6 +48,7 @@ public function destroy(int $tpl)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($tpl) {
|
||||
$this->service->destroy($tpl);
|
||||
|
||||
return 'success';
|
||||
}, '카테고리 템플릿 삭제');
|
||||
}
|
||||
@@ -57,6 +58,7 @@ public function apply(int $id, int $tpl)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id, $tpl) {
|
||||
$this->service->apply($id, $tpl);
|
||||
|
||||
return 'success';
|
||||
}, '카테고리 템플릿 적용');
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\ClassificationService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ClassificationController extends Controller
|
||||
{
|
||||
@@ -35,5 +35,4 @@ public function destroy(string $id)
|
||||
{
|
||||
return ApiResponse::handle(fn () => $this->service->destroy((int) $id), '분류 삭제');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\ClientService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ClientController extends Controller
|
||||
@@ -20,6 +20,7 @@ public function index(Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
$data = $this->service->index($request->all());
|
||||
|
||||
return ['data' => $data, 'message' => __('message.fetched')];
|
||||
});
|
||||
}
|
||||
@@ -28,6 +29,7 @@ public function show(int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id) {
|
||||
$data = $this->service->show($id);
|
||||
|
||||
return ['data' => $data, 'message' => __('message.fetched')];
|
||||
});
|
||||
}
|
||||
@@ -36,6 +38,7 @@ public function store(Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
$data = $this->service->store($request->all());
|
||||
|
||||
return ['data' => $data, 'message' => __('message.created')];
|
||||
});
|
||||
}
|
||||
@@ -44,6 +47,7 @@ public function update(Request $request, int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request, $id) {
|
||||
$data = $this->service->update($id, $request->all());
|
||||
|
||||
return ['data' => $data, 'message' => __('message.updated')];
|
||||
});
|
||||
}
|
||||
@@ -52,6 +56,7 @@ public function destroy(int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id) {
|
||||
$this->service->destroy($id);
|
||||
|
||||
return ['data' => null, 'message' => __('message.deleted')];
|
||||
});
|
||||
}
|
||||
@@ -60,6 +65,7 @@ public function toggle(int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id) {
|
||||
$data = $this->service->toggle($id);
|
||||
|
||||
return ['data' => $data, 'message' => __('message.updated')];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,18 +21,23 @@ class CommonController
|
||||
* description="테넌트의 활성화된 공통 코드 목록을 조회합니다.",
|
||||
* tags={"Settings - Common Codes"},
|
||||
* security={{"ApiKeyAuth": {}}},
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="공통 코드 조회 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="공통코드"),
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="array",
|
||||
*
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="code_group", type="string", example="product_type"),
|
||||
* @OA\Property(property="code", type="string", example="PRODUCT"),
|
||||
* @OA\Property(property="name", type="string", example="제품"),
|
||||
@@ -61,6 +66,7 @@ public static function getComeCode()
|
||||
* description="전체 공통 코드 목록을 조회합니다.",
|
||||
* tags={"Settings - Common Codes"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="공통 코드 목록 조회 성공"
|
||||
@@ -69,7 +75,7 @@ public static function getComeCode()
|
||||
*/
|
||||
public function list(Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
return ApiResponse::handle(function () {
|
||||
// Service implementation needed
|
||||
return [];
|
||||
}, __('message.fetched'));
|
||||
@@ -82,13 +88,16 @@ public function list(Request $request)
|
||||
* description="특정 그룹의 공통 코드 목록을 조회합니다.",
|
||||
* tags={"Settings - Common Codes"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(
|
||||
* name="group",
|
||||
* in="path",
|
||||
* required=true,
|
||||
* description="코드 그룹",
|
||||
*
|
||||
* @OA\Schema(type="string", example="product_type")
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="그룹 코드 조회 성공"
|
||||
@@ -97,7 +106,7 @@ public function list(Request $request)
|
||||
*/
|
||||
public function index(Request $request, string $group)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($group) {
|
||||
return ApiResponse::handle(function () {
|
||||
// Service implementation needed
|
||||
return [];
|
||||
}, __('message.fetched'));
|
||||
@@ -110,16 +119,20 @@ public function index(Request $request, string $group)
|
||||
* description="새로운 공통 코드를 생성합니다.",
|
||||
* tags={"Settings - Common Codes"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="code_group", type="string", example="product_type"),
|
||||
* @OA\Property(property="code", type="string", example="SERVICE"),
|
||||
* @OA\Property(property="name", type="string", example="서비스"),
|
||||
* @OA\Property(property="description", type="string", example="서비스 상품")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=201,
|
||||
* description="공통 코드 생성 성공"
|
||||
@@ -127,22 +140,26 @@ public function index(Request $request, string $group)
|
||||
* @OA\Response(
|
||||
* response=409,
|
||||
* description="중복된 공통 코드",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="중복된 공통 코드가 존재합니다.")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=422,
|
||||
* description="유효성 검사 실패",
|
||||
*
|
||||
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
return ApiResponse::handle(function () {
|
||||
// Service implementation needed
|
||||
return [];
|
||||
}, __('message.settings.common_code_saved'));
|
||||
@@ -155,21 +172,27 @@ public function store(Request $request)
|
||||
* description="기존 공통 코드를 수정합니다.",
|
||||
* tags={"Settings - Common Codes"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(
|
||||
* name="id",
|
||||
* in="path",
|
||||
* required=true,
|
||||
* description="공통 코드 ID",
|
||||
*
|
||||
* @OA\Schema(type="integer", example=1)
|
||||
* ),
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="name", type="string", example="수정된 이름"),
|
||||
* @OA\Property(property="description", type="string", example="수정된 설명")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="공통 코드 수정 성공"
|
||||
@@ -177,22 +200,26 @@ public function store(Request $request)
|
||||
* @OA\Response(
|
||||
* response=404,
|
||||
* description="공통 코드를 찾을 수 없음",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="해당 공통 코드를 찾을 수 없습니다.")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=422,
|
||||
* description="유효성 검사 실패",
|
||||
*
|
||||
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function update(Request $request, int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request, $id) {
|
||||
return ApiResponse::handle(function () {
|
||||
// Service implementation needed
|
||||
return [];
|
||||
}, __('message.updated'));
|
||||
@@ -205,13 +232,16 @@ public function update(Request $request, int $id)
|
||||
* description="공통 코드를 삭제합니다.",
|
||||
* tags={"Settings - Common Codes"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(
|
||||
* name="id",
|
||||
* in="path",
|
||||
* required=true,
|
||||
* description="공통 코드 ID",
|
||||
*
|
||||
* @OA\Schema(type="integer", example=1)
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="공통 코드 삭제 성공"
|
||||
@@ -219,8 +249,10 @@ public function update(Request $request, int $id)
|
||||
* @OA\Response(
|
||||
* response=404,
|
||||
* description="공통 코드를 찾을 수 없음",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="해당 공통 코드를 찾을 수 없습니다.")
|
||||
* )
|
||||
@@ -229,7 +261,7 @@ public function update(Request $request, int $id)
|
||||
*/
|
||||
public function destroy(Request $request, int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id) {
|
||||
return ApiResponse::handle(function () {
|
||||
// Service implementation needed
|
||||
return [];
|
||||
}, __('message.deleted'));
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\DepartmentService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DepartmentController extends Controller
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@ public function index(AuditLogIndexRequest $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
$filters = $request->validated();
|
||||
|
||||
return $this->service->paginate($filters);
|
||||
}, __('message.fetched'));
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Design;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Design\BomCalculationService;
|
||||
use App\Http\Requests\Design\GetEstimateParametersRequest;
|
||||
use App\Http\Requests\Design\CalculateBomRequest;
|
||||
use App\Http\Requests\Design\SaveCompanyFormulaRequest;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Design\CalculateBomRequest;
|
||||
use App\Http\Requests\Design\GetEstimateParametersRequest;
|
||||
use App\Http\Requests\Design\SaveCompanyFormulaRequest;
|
||||
use App\Services\Design\BomCalculationService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BomCalculationController extends Controller
|
||||
{
|
||||
@@ -30,7 +30,7 @@ public function getEstimateParameters(GetEstimateParametersRequest $request, int
|
||||
return [
|
||||
'success' => true,
|
||||
'data' => $result,
|
||||
'message' => __('message.fetched')
|
||||
'message' => __('message.fetched'),
|
||||
];
|
||||
});
|
||||
}
|
||||
@@ -50,14 +50,14 @@ public function calculateBom(CalculateBomRequest $request, int $bomTemplateId):
|
||||
return [
|
||||
'success' => false,
|
||||
'message' => __('error.calculation_failed'),
|
||||
'error' => $result['error']
|
||||
'error' => $result['error'],
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
'data' => $result['data'],
|
||||
'message' => __('message.calculation.completed')
|
||||
'message' => __('message.calculation.completed'),
|
||||
];
|
||||
});
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public function getCompanyFormulas(string $companyName): JsonResponse
|
||||
return [
|
||||
'success' => true,
|
||||
'data' => $result,
|
||||
'message' => __('message.fetched')
|
||||
'message' => __('message.fetched'),
|
||||
];
|
||||
});
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public function saveCompanyFormula(SaveCompanyFormulaRequest $request, string $c
|
||||
return [
|
||||
'success' => true,
|
||||
'data' => $result,
|
||||
'message' => __('message.company_formula.created')
|
||||
'message' => __('message.company_formula.created'),
|
||||
];
|
||||
});
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public function testFormula(Request $request): JsonResponse
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
$request->validate([
|
||||
'formula_expression' => 'required|string',
|
||||
'test_parameters' => 'required|array'
|
||||
'test_parameters' => 'required|array',
|
||||
]);
|
||||
|
||||
$startTime = microtime(true);
|
||||
@@ -115,9 +115,9 @@ public function testFormula(Request $request): JsonResponse
|
||||
'formula_expression' => $request->input('formula_expression'),
|
||||
'input_parameters' => $request->input('test_parameters'),
|
||||
'result' => $result,
|
||||
'execution_time_ms' => round($executionTime, 2)
|
||||
'execution_time_ms' => round($executionTime, 2),
|
||||
],
|
||||
'message' => __('message.formula.test_completed')
|
||||
'message' => __('message.formula.test_completed'),
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public function upsertTemplate(UpsertRequest $request, int $versionId)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request, $versionId) {
|
||||
$payload = $request->validated();
|
||||
|
||||
return $this->service->upsertTemplate(
|
||||
modelVersionId: $versionId,
|
||||
name: $payload['name'] ?? 'Main',
|
||||
@@ -47,6 +48,7 @@ public function replaceItems(ReplaceItemsRequest $request, int $templateId)
|
||||
return ApiResponse::handle(function () use ($request, $templateId) {
|
||||
$payload = $request->validated();
|
||||
$this->service->replaceItems($templateId, $payload['items']);
|
||||
|
||||
return null;
|
||||
}, __('message.bom.bulk_upsert'));
|
||||
}
|
||||
@@ -55,6 +57,7 @@ public function diff(int $templateId, DiffRequest $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($templateId, $request) {
|
||||
$otherId = $request->validated()['other_template_id'];
|
||||
|
||||
return $this->service->diffTemplates($templateId, $otherId);
|
||||
}, __('message.design.template_diff'));
|
||||
}
|
||||
@@ -70,6 +73,7 @@ public function cloneTemplate(int $templateId, CloneRequest $request)
|
||||
isPrimary: (bool) ($payload['is_primary'] ?? false),
|
||||
notes: $payload['notes'] ?? null
|
||||
);
|
||||
|
||||
return $tpl;
|
||||
}, __('message.design.template_cloned'));
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Design\ModelService;
|
||||
use App\Http\Requests\Common\PaginateRequest;
|
||||
use App\Http\Requests\Design\Model\StoreRequest;
|
||||
use App\Http\Requests\Design\Model\UpdateRequest;
|
||||
use App\Services\Design\ModelService;
|
||||
|
||||
class DesignModelController extends Controller
|
||||
{
|
||||
@@ -58,6 +58,7 @@ public function destroy(int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id) {
|
||||
$this->service->delete($id);
|
||||
|
||||
return null;
|
||||
}, __('message.deleted'));
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ public function createDraft(CreateDraftRequest $request, int $modelId)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request, $modelId) {
|
||||
$payload = $request->validated();
|
||||
|
||||
return $this->service->createDraft($modelId, $payload);
|
||||
}, __('message.created'));
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Estimate\CreateEstimateRequest;
|
||||
use App\Http\Requests\Estimate\UpdateEstimateRequest;
|
||||
use App\Services\Estimate\EstimateService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
@@ -27,6 +27,7 @@ public function __construct(EstimateService $estimateService)
|
||||
* summary="견적 목록 조회",
|
||||
* tags={"Estimate"},
|
||||
* security={{"bearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(name="status", in="query", description="견적 상태", @OA\Schema(type="string")),
|
||||
* @OA\Parameter(name="customer_name", in="query", description="고객명", @OA\Schema(type="string")),
|
||||
* @OA\Parameter(name="model_set_id", in="query", description="모델셋 ID", @OA\Schema(type="integer")),
|
||||
@@ -34,6 +35,7 @@ public function __construct(EstimateService $estimateService)
|
||||
* @OA\Parameter(name="date_to", in="query", description="종료일", @OA\Schema(type="string", format="date")),
|
||||
* @OA\Parameter(name="search", in="query", description="검색어", @OA\Schema(type="string")),
|
||||
* @OA\Parameter(name="per_page", in="query", description="페이지당 항목수", @OA\Schema(type="integer", default=20)),
|
||||
*
|
||||
* @OA\Response(response=200, description="성공")
|
||||
* )
|
||||
*/
|
||||
@@ -42,7 +44,7 @@ public function index(Request $request)
|
||||
$estimates = $this->estimateService->getEstimates($request->all());
|
||||
|
||||
return ApiResponse::success([
|
||||
'estimates' => $estimates
|
||||
'estimates' => $estimates,
|
||||
], __('message.fetched'));
|
||||
}
|
||||
|
||||
@@ -52,7 +54,9 @@ public function index(Request $request)
|
||||
* summary="견적 상세 조회",
|
||||
* tags={"Estimate"},
|
||||
* security={{"bearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
||||
*
|
||||
* @OA\Response(response=200, description="성공")
|
||||
* )
|
||||
*/
|
||||
@@ -61,7 +65,7 @@ public function show($id)
|
||||
$estimate = $this->estimateService->getEstimateDetail($id);
|
||||
|
||||
return ApiResponse::success([
|
||||
'estimate' => $estimate
|
||||
'estimate' => $estimate,
|
||||
], __('message.fetched'));
|
||||
}
|
||||
|
||||
@@ -71,10 +75,13 @@ public function show($id)
|
||||
* summary="견적 생성",
|
||||
* tags={"Estimate"},
|
||||
* security={{"bearerAuth": {}}},
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* required={"model_set_id", "estimate_name", "parameters"},
|
||||
*
|
||||
* @OA\Property(property="model_set_id", type="integer", description="모델셋 ID"),
|
||||
* @OA\Property(property="estimate_name", type="string", description="견적명"),
|
||||
* @OA\Property(property="customer_name", type="string", description="고객명"),
|
||||
@@ -83,6 +90,7 @@ public function show($id)
|
||||
* @OA\Property(property="notes", type="string", description="비고")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=201, description="생성 성공")
|
||||
* )
|
||||
*/
|
||||
@@ -91,7 +99,7 @@ public function store(CreateEstimateRequest $request)
|
||||
$estimate = $this->estimateService->createEstimate($request->validated());
|
||||
|
||||
return ApiResponse::success([
|
||||
'estimate' => $estimate
|
||||
'estimate' => $estimate,
|
||||
], __('message.created'), 201);
|
||||
}
|
||||
|
||||
@@ -101,10 +109,14 @@ public function store(CreateEstimateRequest $request)
|
||||
* summary="견적 수정",
|
||||
* tags={"Estimate"},
|
||||
* security={{"bearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
*
|
||||
* @OA\Property(property="estimate_name", type="string", description="견적명"),
|
||||
* @OA\Property(property="customer_name", type="string", description="고객명"),
|
||||
* @OA\Property(property="project_name", type="string", description="프로젝트명"),
|
||||
@@ -113,6 +125,7 @@ public function store(CreateEstimateRequest $request)
|
||||
* @OA\Property(property="notes", type="string", description="비고")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=200, description="수정 성공")
|
||||
* )
|
||||
*/
|
||||
@@ -121,7 +134,7 @@ public function update(UpdateEstimateRequest $request, $id)
|
||||
$estimate = $this->estimateService->updateEstimate($id, $request->validated());
|
||||
|
||||
return ApiResponse::success([
|
||||
'estimate' => $estimate
|
||||
'estimate' => $estimate,
|
||||
], __('message.updated'));
|
||||
}
|
||||
|
||||
@@ -131,7 +144,9 @@ public function update(UpdateEstimateRequest $request, $id)
|
||||
* summary="견적 삭제",
|
||||
* tags={"Estimate"},
|
||||
* security={{"bearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
||||
*
|
||||
* @OA\Response(response=200, description="삭제 성공")
|
||||
* )
|
||||
*/
|
||||
@@ -148,17 +163,22 @@ public function destroy($id)
|
||||
* summary="견적 복제",
|
||||
* tags={"Estimate"},
|
||||
* security={{"bearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* required={"estimate_name"},
|
||||
*
|
||||
* @OA\Property(property="estimate_name", type="string", description="새 견적명"),
|
||||
* @OA\Property(property="customer_name", type="string", description="고객명"),
|
||||
* @OA\Property(property="project_name", type="string", description="프로젝트명"),
|
||||
* @OA\Property(property="notes", type="string", description="비고")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=201, description="복제 성공")
|
||||
* )
|
||||
*/
|
||||
@@ -174,7 +194,7 @@ public function clone(Request $request, $id)
|
||||
$newEstimate = $this->estimateService->cloneEstimate($id, $request->all());
|
||||
|
||||
return ApiResponse::success([
|
||||
'estimate' => $newEstimate
|
||||
'estimate' => $newEstimate,
|
||||
], __('message.estimate.cloned'), 201);
|
||||
}
|
||||
|
||||
@@ -184,15 +204,20 @@ public function clone(Request $request, $id)
|
||||
* summary="견적 상태 변경",
|
||||
* tags={"Estimate"},
|
||||
* security={{"bearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* required={"status"},
|
||||
*
|
||||
* @OA\Property(property="status", type="string", enum={"DRAFT","SENT","APPROVED","REJECTED","EXPIRED"}, description="변경할 상태"),
|
||||
* @OA\Property(property="notes", type="string", description="상태 변경 사유")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=200, description="상태 변경 성공")
|
||||
* )
|
||||
*/
|
||||
@@ -210,7 +235,7 @@ public function changeStatus(Request $request, $id)
|
||||
);
|
||||
|
||||
return ApiResponse::success([
|
||||
'estimate' => $estimate
|
||||
'estimate' => $estimate,
|
||||
], __('message.estimate.status_changed'));
|
||||
}
|
||||
|
||||
@@ -220,7 +245,9 @@ public function changeStatus(Request $request, $id)
|
||||
* summary="견적 폼 스키마 조회",
|
||||
* tags={"Estimate"},
|
||||
* security={{"bearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(name="model_set_id", in="path", required=true, description="모델셋 ID", @OA\Schema(type="integer")),
|
||||
*
|
||||
* @OA\Response(response=200, description="성공")
|
||||
* )
|
||||
*/
|
||||
@@ -229,7 +256,7 @@ public function getFormSchema($modelSetId)
|
||||
$schema = $this->estimateService->getEstimateFormSchema($modelSetId);
|
||||
|
||||
return ApiResponse::success([
|
||||
'form_schema' => $schema
|
||||
'form_schema' => $schema,
|
||||
], __('message.fetched'));
|
||||
}
|
||||
|
||||
@@ -239,14 +266,19 @@ public function getFormSchema($modelSetId)
|
||||
* summary="견적 계산 미리보기",
|
||||
* tags={"Estimate"},
|
||||
* security={{"bearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(name="model_set_id", in="path", required=true, description="모델셋 ID", @OA\Schema(type="integer")),
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* required={"parameters"},
|
||||
*
|
||||
* @OA\Property(property="parameters", type="object", description="견적 파라미터")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=200, description="계산 성공")
|
||||
* )
|
||||
*/
|
||||
@@ -263,7 +295,7 @@ public function previewCalculation(Request $request, $modelSetId)
|
||||
);
|
||||
|
||||
return ApiResponse::success([
|
||||
'calculation' => $calculation
|
||||
'calculation' => $calculation,
|
||||
], __('message.calculated'));
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\FileService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\FileService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* @OA\Tag(
|
||||
@@ -22,33 +22,43 @@ class FileController extends Controller
|
||||
* description="파일을 업로드합니다.",
|
||||
* tags={"Files"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\MediaType(
|
||||
* mediaType="multipart/form-data",
|
||||
*
|
||||
* @OA\Schema(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(
|
||||
* property="files[]",
|
||||
* type="array",
|
||||
*
|
||||
* @OA\Items(type="string", format="binary"),
|
||||
* description="업로드할 파일들"
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=201,
|
||||
* description="파일 업로드 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="파일 업로드"),
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="array",
|
||||
*
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="id", type="integer", example=1),
|
||||
* @OA\Property(property="filename", type="string", example="document.pdf"),
|
||||
* @OA\Property(property="path", type="string", example="/uploads/tenant/1/document.pdf"),
|
||||
@@ -57,29 +67,38 @@ class FileController extends Controller
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=400,
|
||||
* description="파일 업로드 실패",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="파일 업로드에 실패했습니다.")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=413,
|
||||
* description="파일 크기 초과",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="파일 크기가 너무 큽니다.")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=415,
|
||||
* description="지원하지 않는 파일 형식",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="허용되지 않는 파일 형식입니다.")
|
||||
* )
|
||||
@@ -100,23 +119,30 @@ public function upload(Request $request)
|
||||
* description="파일 목록을 조회합니다.",
|
||||
* tags={"Files"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(
|
||||
* name="page",
|
||||
* in="query",
|
||||
* description="페이지 번호",
|
||||
*
|
||||
* @OA\Schema(type="integer", example=1)
|
||||
* ),
|
||||
*
|
||||
* @OA\Parameter(
|
||||
* name="size",
|
||||
* in="query",
|
||||
* description="페이지 크기",
|
||||
*
|
||||
* @OA\Schema(type="integer", example=10)
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="파일 목록 조회 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="파일 목록조회"),
|
||||
* @OA\Property(
|
||||
@@ -128,8 +154,10 @@ public function upload(Request $request)
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="array",
|
||||
*
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="id", type="integer", example=1),
|
||||
* @OA\Property(property="filename", type="string", example="document.pdf"),
|
||||
* @OA\Property(property="path", type="string", example="/uploads/tenant/1/document.pdf"),
|
||||
@@ -156,32 +184,42 @@ public function list(Request $request)
|
||||
* description="파일을 삭제합니다.",
|
||||
* tags={"Files"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(
|
||||
* property="file_ids",
|
||||
* type="array",
|
||||
*
|
||||
* @OA\Items(type="integer"),
|
||||
* example={1, 2, 3}
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="파일 삭제 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="파일 삭제")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=404,
|
||||
* description="파일을 찾을 수 없음",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="파일을 찾을 수 없습니다.")
|
||||
* )
|
||||
@@ -202,18 +240,23 @@ public function delete(Request $request)
|
||||
* description="특정 파일의 정보를 조회합니다.",
|
||||
* tags={"Files"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(
|
||||
* name="file_id",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* description="파일 ID",
|
||||
*
|
||||
* @OA\Schema(type="integer", example=1)
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="파일 정보 조회 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="파일 정보 조회"),
|
||||
* @OA\Property(
|
||||
@@ -228,11 +271,14 @@ public function delete(Request $request)
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=404,
|
||||
* description="파일을 찾을 수 없음",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="파일을 찾을 수 없습니다.")
|
||||
* )
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\MaterialService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* @OA\Tag(
|
||||
@@ -24,29 +24,38 @@ public function __construct(private MaterialService $service) {}
|
||||
* description="테넌트의 자재 목록을 조회합니다. (Products & Materials 통합 관리)",
|
||||
* tags={"Products & Materials - Materials"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(
|
||||
* name="page",
|
||||
* in="query",
|
||||
* description="페이지 번호",
|
||||
*
|
||||
* @OA\Schema(type="integer", example=1)
|
||||
* ),
|
||||
*
|
||||
* @OA\Parameter(
|
||||
* name="size",
|
||||
* in="query",
|
||||
* description="페이지 크기",
|
||||
*
|
||||
* @OA\Schema(type="integer", example=10)
|
||||
* ),
|
||||
*
|
||||
* @OA\Parameter(
|
||||
* name="q",
|
||||
* in="query",
|
||||
* description="검색어 (자재명, 코드)",
|
||||
*
|
||||
* @OA\Schema(type="string", example="스틸")
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="자재 목록 조회 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="조회 성공"),
|
||||
* @OA\Property(
|
||||
@@ -58,8 +67,10 @@ public function __construct(private MaterialService $service) {}
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="array",
|
||||
*
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="id", type="integer", example=1),
|
||||
* @OA\Property(property="material_code", type="string", example="MAT001"),
|
||||
* @OA\Property(property="name", type="string", example="스틸파이프 10mm"),
|
||||
@@ -87,10 +98,13 @@ public function index(Request $request)
|
||||
* description="새로운 자재를 등록합니다.",
|
||||
* tags={"Products & Materials - Materials"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="material_code", type="string", example="MAT002"),
|
||||
* @OA\Property(property="name", type="string", example="알루미늄 프로파일"),
|
||||
* @OA\Property(property="specification", type="string", example="20x20x2mm"),
|
||||
@@ -98,11 +112,14 @@ public function index(Request $request)
|
||||
* @OA\Property(property="description", type="string", example="알루미늄 프로파일 20x20")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=201,
|
||||
* description="자재 등록 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="자재가 등록되었습니다."),
|
||||
* @OA\Property(
|
||||
@@ -112,18 +129,23 @@ public function index(Request $request)
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=409,
|
||||
* description="중복된 자재 코드",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="중복된 자재 코드입니다.")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=422,
|
||||
* description="유효성 검사 실패",
|
||||
*
|
||||
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
||||
* )
|
||||
* )
|
||||
@@ -142,18 +164,23 @@ public function store(Request $request)
|
||||
* description="특정 자재의 상세 정보를 조회합니다.",
|
||||
* tags={"Products & Materials - Materials"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(
|
||||
* name="id",
|
||||
* in="path",
|
||||
* required=true,
|
||||
* description="자재 ID",
|
||||
*
|
||||
* @OA\Schema(type="integer", example=1)
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="자재 상세 조회 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="조회 성공"),
|
||||
* @OA\Property(
|
||||
@@ -171,9 +198,11 @@ public function store(Request $request)
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=404,
|
||||
* description="자재 정보를 찾을 수 없음",
|
||||
*
|
||||
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
||||
* )
|
||||
* )
|
||||
@@ -192,27 +221,35 @@ public function show(Request $request, int $id)
|
||||
* description="기존 자재 정보를 수정합니다.",
|
||||
* tags={"Products & Materials - Materials"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(
|
||||
* name="id",
|
||||
* in="path",
|
||||
* required=true,
|
||||
* description="자재 ID",
|
||||
*
|
||||
* @OA\Schema(type="integer", example=1)
|
||||
* ),
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="name", type="string", example="스틸파이프 12mm"),
|
||||
* @OA\Property(property="specification", type="string", example="직경 12mm, 두께 2mm"),
|
||||
* @OA\Property(property="description", type="string", example="수정된 스틸 파이프")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="자재 수정 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="자재가 수정되었습니다.")
|
||||
* )
|
||||
@@ -233,36 +270,47 @@ public function update(Request $request, int $id)
|
||||
* description="자재를 소프트 삭제합니다. 사용 중인 자재는 삭제할 수 없습니다.",
|
||||
* tags={"Products & Materials - Materials"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(
|
||||
* name="id",
|
||||
* in="path",
|
||||
* required=true,
|
||||
* description="자재 ID",
|
||||
*
|
||||
* @OA\Schema(type="integer", example=1)
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="자재 삭제 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="자재가 삭제되었습니다.")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=409,
|
||||
* description="사용 중인 자재는 삭제 불가",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="사용 중인 자재는 삭제할 수 없습니다.")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=404,
|
||||
* description="자재 정보를 찾을 수 없음",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="자재 정보를 찾을 수 없습니다.")
|
||||
* )
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\MenuService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MenuController extends Controller
|
||||
{
|
||||
@@ -33,7 +33,9 @@ public function store(Request $request)
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request, $id) {
|
||||
$params = $request->all(); $params['id'] = (int)$id;
|
||||
$params = $request->all();
|
||||
$params['id'] = (int) $id;
|
||||
|
||||
return MenuService::update($params);
|
||||
}, '메뉴 수정');
|
||||
}
|
||||
@@ -55,7 +57,9 @@ public function reorder(Request $request)
|
||||
public function toggle(Request $request, $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request, $id) {
|
||||
$params = $request->all(); $params['id'] = (int)$id;
|
||||
$params = $request->all();
|
||||
$params['id'] = (int) $id;
|
||||
|
||||
return MenuService::toggle($params);
|
||||
}, '메뉴 상태 토글');
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\ModelSet\CloneModelSetRequest;
|
||||
use App\Http\Requests\ModelSet\CreateModelSetRequest;
|
||||
use App\Http\Requests\ModelSet\UpdateModelSetRequest;
|
||||
use App\Http\Requests\ModelSet\CloneModelSetRequest;
|
||||
use App\Services\ModelSet\ModelSetService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ModelSetController extends Controller
|
||||
@@ -27,7 +27,7 @@ public function index(Request $request)
|
||||
$modelSets = $this->modelSetService->getModelSets($request->validated());
|
||||
|
||||
return ApiResponse::success([
|
||||
'model_sets' => $modelSets
|
||||
'model_sets' => $modelSets,
|
||||
], __('message.fetched'));
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public function show($id)
|
||||
$modelSet = $this->modelSetService->getModelSetDetail($id);
|
||||
|
||||
return ApiResponse::success([
|
||||
'model_set' => $modelSet
|
||||
'model_set' => $modelSet,
|
||||
], __('message.fetched'));
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public function store(CreateModelSetRequest $request)
|
||||
$modelSet = $this->modelSetService->createModelSet($request->validated());
|
||||
|
||||
return ApiResponse::success([
|
||||
'model_set' => $modelSet
|
||||
'model_set' => $modelSet,
|
||||
], __('message.created'));
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public function update(UpdateModelSetRequest $request, $id)
|
||||
$modelSet = $this->modelSetService->updateModelSet($id, $request->validated());
|
||||
|
||||
return ApiResponse::success([
|
||||
'model_set' => $modelSet
|
||||
'model_set' => $modelSet,
|
||||
], __('message.updated'));
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public function clone(CloneModelSetRequest $request, $id)
|
||||
$newModelSet = $this->modelSetService->cloneModelSet($id, $request->validated());
|
||||
|
||||
return ApiResponse::success([
|
||||
'model_set' => $newModelSet
|
||||
'model_set' => $newModelSet,
|
||||
], __('message.model_set.cloned'));
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public function getCategoryFields($id)
|
||||
$fields = $this->modelSetService->getModelSetCategoryFields($id);
|
||||
|
||||
return ApiResponse::success([
|
||||
'category_fields' => $fields
|
||||
'category_fields' => $fields,
|
||||
], __('message.fetched'));
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public function getBomTemplates($id)
|
||||
$templates = $this->modelSetService->getModelSetBomTemplates($id);
|
||||
|
||||
return ApiResponse::success([
|
||||
'bom_templates' => $templates
|
||||
'bom_templates' => $templates,
|
||||
], __('message.fetched'));
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public function getEstimateParameters($id, Request $request)
|
||||
$parameters = $this->modelSetService->getEstimateParameters($id, $request->all());
|
||||
|
||||
return ApiResponse::success([
|
||||
'parameters' => $parameters
|
||||
'parameters' => $parameters,
|
||||
], __('message.fetched'));
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ public function destroy(int $id, int $item)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id, $item) {
|
||||
$this->service->destroy($id, $item);
|
||||
|
||||
return 'success';
|
||||
}, 'BOM 항목 삭제');
|
||||
}
|
||||
@@ -49,6 +50,7 @@ public function reorder(int $id, Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id, $request) {
|
||||
$this->service->reorder($id, $request->input('items', []));
|
||||
|
||||
return 'success';
|
||||
}, 'BOM 정렬 변경');
|
||||
}
|
||||
@@ -81,7 +83,6 @@ public function replace(Request $request, int $id)
|
||||
}, __('message.bom.creat'));
|
||||
}
|
||||
|
||||
|
||||
/** 특정 제품 BOM에서 사용 중인 카테고리 목록 */
|
||||
public function listCategories(int $id)
|
||||
{
|
||||
@@ -96,12 +97,11 @@ public function suggestCategories(Request $request)
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
$q = $request->query('q');
|
||||
$limit = (int) ($request->query('limit', 20));
|
||||
|
||||
return $this->service->listCategoriesForTenant($q, $limit);
|
||||
}, __('message.bom.fetch'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Bom Tree */
|
||||
public function tree(Request $request, int $id)
|
||||
{
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\ProductService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ProductController extends Controller
|
||||
{
|
||||
@@ -56,6 +55,7 @@ public function destroy(int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id) {
|
||||
$this->service->destroy($id);
|
||||
|
||||
return 'success';
|
||||
}, '제품 삭제');
|
||||
}
|
||||
@@ -76,4 +76,3 @@ public function toggle(int $id)
|
||||
}, '제품 활성 토글');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Authz\RoleService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RoleController extends Controller
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Authz\RolePermissionService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RolePermissionController extends Controller
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\TenantService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TenantController extends Controller
|
||||
{
|
||||
@@ -50,6 +50,4 @@ public function restore(Request $request)
|
||||
return TenantService::restoreTenant($request->all());
|
||||
}, '테넌트 복구');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\TenantFieldSettingService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* @OA\Tag(
|
||||
@@ -22,18 +22,23 @@ class TenantFieldSettingController extends Controller
|
||||
* description="전역 + 테넌트별 병합된 필드 설정 효과값을 조회합니다.",
|
||||
* tags={"Settings - Fields"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="필드 설정 목록 조회 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="조회 성공"),
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="array",
|
||||
*
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="field_key", type="string", example="product_name_required"),
|
||||
* @OA\Property(property="field_value", type="string", example="true"),
|
||||
* @OA\Property(property="source", type="string", example="tenant", description="global 또는 tenant")
|
||||
@@ -57,38 +62,50 @@ public function index(Request $request)
|
||||
* description="여러 필드 설정을 트랜잭션으로 일괄 저장합니다.",
|
||||
* tags={"Settings - Fields"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(
|
||||
* property="fields",
|
||||
* type="array",
|
||||
*
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="field_key", type="string", example="product_name_required"),
|
||||
* @OA\Property(property="field_value", type="string", example="true")
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="대량 저장 성공",
|
||||
*
|
||||
* @OA\JsonContent(ref="#/components/schemas/ApiResponse")
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=400,
|
||||
* description="유효하지 않은 필드 타입",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="유효하지 않은 필드 타입입니다.")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=422,
|
||||
* description="유효성 검사 실패",
|
||||
*
|
||||
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
||||
* )
|
||||
* )
|
||||
@@ -107,39 +124,52 @@ public function bulkUpsert(Request $request)
|
||||
* description="특정 필드 설정을 개별적으로 수정합니다.",
|
||||
* tags={"Settings - Fields"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
*
|
||||
* @OA\Parameter(
|
||||
* name="key",
|
||||
* in="path",
|
||||
* required=true,
|
||||
* description="필드 키",
|
||||
*
|
||||
* @OA\Schema(type="string", example="product_name_required")
|
||||
* ),
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="field_value", type="string", example="false")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="필드 설정 수정 성공",
|
||||
*
|
||||
* @OA\JsonContent(ref="#/components/schemas/ApiResponse")
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=404,
|
||||
* description="필드 설정을 찾을 수 없음",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="해당 필드 설정을 찾을 수 없습니다.")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=400,
|
||||
* description="유효하지 않은 필드 타입",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="유효하지 않은 필드 타입입니다.")
|
||||
* )
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\TenantOptionGroupService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TenantOptionGroupController extends Controller
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\TenantOptionValueService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TenantOptionValueController extends Controller
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\TenantUserProfileService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TenantUserProfileController extends Controller
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\MemberService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
@@ -54,9 +54,9 @@ public function tenants(Request $request)
|
||||
public function switchTenant(Request $request)
|
||||
{
|
||||
$tenant_id = $request->tenant_id;
|
||||
|
||||
return ApiResponse::handle(function () use ($tenant_id) {
|
||||
return MemberService::switchMyTenant($tenant_id);
|
||||
}, '활성 테넌트 전환');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Authz\UserRoleService;
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UserRoleController extends Controller
|
||||
{
|
||||
|
||||
@@ -24,7 +24,6 @@ public function handle(Request $request, Closure $next)
|
||||
'headers' => $request->headers->all(),
|
||||
]);
|
||||
|
||||
|
||||
$apiKey = $request->header('X-API-KEY');
|
||||
|
||||
$validApiKey = false;
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Models\Members\User as UserModel;
|
||||
use App\Services\Authz\AccessService;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\PermissionRegistrar;
|
||||
use App\Services\Authz\AccessService;
|
||||
use App\Models\Members\User as UserModel;
|
||||
|
||||
class CheckPermission
|
||||
{
|
||||
@@ -48,6 +48,7 @@ public function handle(Request $request, Closure $next)
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json(['success' => false, 'message' => '권한이 없습니다.', 'data' => null], 403);
|
||||
}
|
||||
if (! AccessService::allows($user, $perm, $tenantId, 'api')) {
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Models\Member;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use App\Models\Member;
|
||||
|
||||
class CheckSwaggerAuth
|
||||
{
|
||||
@@ -16,6 +16,7 @@ public function handle(Request $request, Closure $next)
|
||||
if (! $token) {
|
||||
// 원래 URL 저장 후 로그인 페이지로 이동
|
||||
Session::put('redirect_to', $request->fullUrl());
|
||||
|
||||
return redirect()->route('login');
|
||||
}
|
||||
|
||||
@@ -26,6 +27,7 @@ public function handle(Request $request, Closure $next)
|
||||
Session::forget('user_id');
|
||||
|
||||
Session::put('redirect_to', $request->fullUrl());
|
||||
|
||||
return redirect()->route('login');
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ public function handle(Request $request, Closure $next)
|
||||
$forced = $route->defaults['perm'] ?? $route->defaults['permission'] ?? null;
|
||||
if ($forced) {
|
||||
$request->attributes->set('perm', $forced);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Common;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class PaginateRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool { return true; }
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
@@ -24,6 +28,7 @@ public function validatedOrDefaults(): array
|
||||
$v['page'] = $v['page'] ?? 1;
|
||||
$v['size'] = $v['size'] ?? 20;
|
||||
$v['order'] = $v['order'] ?? 'desc';
|
||||
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Design\BomTemplate;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use App\Support\Validation\BomItemRules;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ReplaceItemsRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool { return true; }
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ public function rules(): array
|
||||
'parameters.power_source' => 'nullable|string|in:manual,electric,automatic',
|
||||
'parameters.motor_type' => 'nullable|string|in:standard,low_noise,high_torque',
|
||||
'parameters.material_grade' => 'nullable|string|in:standard,premium,luxury',
|
||||
'company_name' => 'nullable|string|max:100'
|
||||
'company_name' => 'nullable|string|max:100',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public function messages(): array
|
||||
'parameters.material_grade.string' => __('error.validation.string'),
|
||||
'parameters.material_grade.in' => __('error.validation.in'),
|
||||
'company_name.string' => __('error.validation.string'),
|
||||
'company_name.max' => __('error.validation.max.string')
|
||||
'company_name.max' => __('error.validation.max.string'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public function attributes(): array
|
||||
'parameters.power_source' => '동력원',
|
||||
'parameters.motor_type' => '모터타입',
|
||||
'parameters.material_grade' => '자재등급',
|
||||
'company_name' => '업체명'
|
||||
'company_name' => '업체명',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public function authorize(): bool
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'company_name' => 'nullable|string|max:100'
|
||||
'company_name' => 'nullable|string|max:100',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public function messages(): array
|
||||
{
|
||||
return [
|
||||
'company_name.string' => __('error.validation.string'),
|
||||
'company_name.max' => __('error.validation.max.string')
|
||||
'company_name.max' => __('error.validation.max.string'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Design\Model;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool { return true; }
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ public function rules(): array
|
||||
'validation_rules.*.field' => 'nullable|string|max:50',
|
||||
'validation_rules.*.rule' => 'nullable|string|max:200',
|
||||
'validation_rules.*.message' => 'nullable|string|max:200',
|
||||
'description' => 'nullable|string|max:500'
|
||||
'description' => 'nullable|string|max:500',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public function messages(): array
|
||||
'validation_rules.*.message.string' => __('error.validation.string'),
|
||||
'validation_rules.*.message.max' => __('error.validation.max.string'),
|
||||
'description.string' => __('error.validation.string'),
|
||||
'description.max' => __('error.validation.max.string')
|
||||
'description.max' => __('error.validation.max.string'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public function attributes(): array
|
||||
'validation_rules.*.field' => '검증 필드',
|
||||
'validation_rules.*.rule' => '검증 규칙',
|
||||
'validation_rules.*.message' => '검증 메시지',
|
||||
'description' => '설명'
|
||||
'description' => '설명',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Models\Boards;
|
||||
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
@@ -11,15 +10,19 @@
|
||||
class Board extends Model
|
||||
{
|
||||
protected $table = 'boards';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'board_code', 'name', 'description', 'editor_type',
|
||||
'allow_files', 'max_file_count', 'max_file_size', 'extra_settings', 'is_active'
|
||||
'allow_files', 'max_file_count', 'max_file_size', 'extra_settings', 'is_active',
|
||||
];
|
||||
|
||||
public function customFields() {
|
||||
public function customFields()
|
||||
{
|
||||
return $this->hasMany(BoardSetting::class, 'board_id');
|
||||
}
|
||||
public function posts() {
|
||||
|
||||
public function posts()
|
||||
{
|
||||
return $this->hasMany(Post::class, 'board_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Models\Boards;
|
||||
|
||||
use App\Models\Members\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Members\User;
|
||||
|
||||
/**
|
||||
* @mixin IdeHelperBoardComment
|
||||
@@ -14,20 +14,28 @@ class BoardComment extends Model
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'board_comments';
|
||||
|
||||
protected $fillable = [
|
||||
'post_id', 'tenant_id', 'user_id', 'parent_id', 'content', 'ip_address', 'status'
|
||||
'post_id', 'tenant_id', 'user_id', 'parent_id', 'content', 'ip_address', 'status',
|
||||
];
|
||||
|
||||
public function post() {
|
||||
public function post()
|
||||
{
|
||||
return $this->belongsTo(Post::class, 'post_id');
|
||||
}
|
||||
public function user() {
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
public function parent() {
|
||||
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(BoardComment::class, 'parent_id');
|
||||
}
|
||||
public function children() {
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(BoardComment::class, 'parent_id')->where('status', 'active');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,13 @@
|
||||
class BoardSetting extends Model
|
||||
{
|
||||
protected $table = 'board_settings';
|
||||
|
||||
protected $fillable = [
|
||||
'board_id', 'name', 'field_key', 'field_type', 'field_meta', 'is_required', 'sort_order'
|
||||
'board_id', 'name', 'field_key', 'field_type', 'field_meta', 'is_required', 'sort_order',
|
||||
];
|
||||
|
||||
public function board() {
|
||||
public function board()
|
||||
{
|
||||
return $this->belongsTo(Board::class, 'board_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Models\Boards;
|
||||
|
||||
use App\Models\Commons\File;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Commons\File;
|
||||
|
||||
/**
|
||||
* @mixin IdeHelperPost
|
||||
@@ -14,18 +14,24 @@ class Post extends Model
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'posts';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'board_id', 'user_id', 'title', 'content', 'editor_type',
|
||||
'ip_address', 'is_notice', 'is_secret', 'views', 'status'
|
||||
'ip_address', 'is_notice', 'is_secret', 'views', 'status',
|
||||
];
|
||||
|
||||
public function files() {
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany(File::class, 'fileable');
|
||||
}
|
||||
public function comments() {
|
||||
|
||||
public function comments()
|
||||
{
|
||||
return $this->hasMany(BoardComment::class, 'post_id')->whereNull('parent_id')->where('status', 'active');
|
||||
}
|
||||
public function board() {
|
||||
|
||||
public function board()
|
||||
{
|
||||
return $this->belongsTo(Board::class, 'board_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,12 +10,16 @@
|
||||
class PostCustomFieldValue extends Model
|
||||
{
|
||||
protected $table = 'post_custom_field_values';
|
||||
|
||||
protected $fillable = ['post_id', 'field_id', 'value'];
|
||||
|
||||
public function post() {
|
||||
public function post()
|
||||
{
|
||||
return $this->belongsTo(Post::class, 'post_id');
|
||||
}
|
||||
public function field() {
|
||||
|
||||
public function field()
|
||||
{
|
||||
return $this->belongsTo(BoardSetting::class, 'field_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Models\Calculation;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CalculationConfig extends Model
|
||||
{
|
||||
@@ -21,14 +21,14 @@ class CalculationConfig extends Model
|
||||
'description',
|
||||
'is_active',
|
||||
'created_by',
|
||||
'updated_by'
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'parameters' => 'array',
|
||||
'conditions' => 'array',
|
||||
'validation_rules' => 'array',
|
||||
'is_active' => 'boolean'
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
|
||||
class Category extends Model
|
||||
{
|
||||
use SoftDeletes, BelongsToTenant, ModelTrait;
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'parent_id', 'code_group', 'code', 'name',
|
||||
'profile_code', // capability_profile 연결
|
||||
'is_active', 'sort_order', 'description',
|
||||
'created_by','updated_by','deleted_by'
|
||||
'created_by', 'updated_by', 'deleted_by',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
@@ -24,23 +24,46 @@ class Category extends Model
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'deleted_by','deleted_at'
|
||||
'deleted_by', 'deleted_at',
|
||||
];
|
||||
|
||||
// 계층
|
||||
public function parent() { return $this->belongsTo(self::class, 'parent_id'); }
|
||||
public function children() { return $this->hasMany(self::class, 'parent_id'); }
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(self::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(self::class, 'parent_id');
|
||||
}
|
||||
|
||||
// 카테고리의 제품들
|
||||
public function products() { return $this->hasMany(\App\Models\Products\Product::class, 'category_id'); }
|
||||
public function products()
|
||||
{
|
||||
return $this->hasMany(\App\Models\Products\Product::class, 'category_id');
|
||||
}
|
||||
|
||||
// 카테고리 필드
|
||||
public function categoryFields() { return $this->hasMany(CategoryField::class, 'category_id'); }
|
||||
public function categoryFields()
|
||||
{
|
||||
return $this->hasMany(CategoryField::class, 'category_id');
|
||||
}
|
||||
|
||||
// 태그(폴리모픽) — 이미 taggables 존재
|
||||
public function tags() { return $this->morphToMany(\App\Models\Commons\Tag::class, 'taggable'); }
|
||||
public function tags()
|
||||
{
|
||||
return $this->morphToMany(\App\Models\Commons\Tag::class, 'taggable');
|
||||
}
|
||||
|
||||
// 스코프
|
||||
public function scopeGroup($q, string $group) { return $q->where('code_group', $group); }
|
||||
public function scopeCode($q, string $code) { return $q->where('code', $code); }
|
||||
public function scopeGroup($q, string $group)
|
||||
{
|
||||
return $q->where('code_group', $group);
|
||||
}
|
||||
|
||||
public function scopeCode($q, string $code)
|
||||
{
|
||||
return $q->where('code', $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
class CategoryField extends Model
|
||||
{
|
||||
use SoftDeletes, BelongsToTenant, ModelTrait;
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $table = 'category_fields';
|
||||
|
||||
@@ -32,5 +32,8 @@ public function category()
|
||||
}
|
||||
|
||||
// 편의 스코프
|
||||
public function scopeRequired($q) { return $q->where('is_required', 1); }
|
||||
public function scopeRequired($q)
|
||||
{
|
||||
return $q->where('is_required', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ class CategoryLog extends Model
|
||||
use BelongsToTenant, ModelTrait;
|
||||
|
||||
protected $table = 'category_logs';
|
||||
|
||||
public $timestamps = false; // changed_at 컬럼 단일 사용
|
||||
|
||||
protected $fillable = [
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
class Classification extends Model
|
||||
{
|
||||
use SoftDeletes, ModelTrait, BelongsToTenant;
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Models\Commons;
|
||||
|
||||
use App\Models\Members\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Members\User;
|
||||
|
||||
/**
|
||||
* @mixin IdeHelperFile
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
|
||||
namespace App\Models\Commons;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Scopes\TenantScope;
|
||||
use App\Traits\BelongsToTenant;
|
||||
use App\Traits\ModelTrait;
|
||||
use App\Models\Scopes\TenantScope;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @mixin IdeHelperMenu
|
||||
*/
|
||||
class Menu extends Model
|
||||
{
|
||||
use SoftDeletes, BelongsToTenant, ModelTrait;
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'parent_id', 'name', 'url', 'is_active', 'sort_order',
|
||||
@@ -25,7 +25,7 @@ class Menu extends Model
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'deleted_by',
|
||||
'deleted_at'
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public function parent()
|
||||
|
||||
@@ -23,7 +23,6 @@ public function tenant(): BelongsTo
|
||||
return $this->belongsTo(Tenant::class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 제품(Product)와 연결 (N:M, 폴리모픽)
|
||||
*/
|
||||
@@ -47,5 +46,4 @@ public function materials(): MorphToMany
|
||||
{
|
||||
return $this->morphedByMany(Material::class, 'taggable');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,11 +21,13 @@ class BomTemplate extends Model
|
||||
'calculation_schema' => 'array',
|
||||
];
|
||||
|
||||
public function modelVersion() {
|
||||
public function modelVersion()
|
||||
{
|
||||
return $this->belongsTo(ModelVersion::class, 'model_version_id');
|
||||
}
|
||||
|
||||
public function items() {
|
||||
public function items()
|
||||
{
|
||||
return $this->hasMany(BomTemplateItem::class, 'bom_template_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ class BomTemplateItem extends Model
|
||||
'calculation_config' => 'array',
|
||||
];
|
||||
|
||||
public function template() {
|
||||
public function template()
|
||||
{
|
||||
return $this->belongsTo(BomTemplate::class, 'bom_template_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ class DesignModel extends Model
|
||||
];
|
||||
|
||||
// 관계: 모델은 여러 버전을 가짐
|
||||
public function versions() {
|
||||
public function versions()
|
||||
{
|
||||
return $this->hasMany(ModelVersion::class, 'model_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,15 +21,18 @@ class ModelVersion extends Model
|
||||
'effective_to' => 'datetime',
|
||||
];
|
||||
|
||||
public function model() {
|
||||
public function model()
|
||||
{
|
||||
return $this->belongsTo(DesignModel::class, 'model_id');
|
||||
}
|
||||
|
||||
public function bomTemplates() {
|
||||
public function bomTemplates()
|
||||
{
|
||||
return $this->hasMany(BomTemplate::class, 'model_version_id');
|
||||
}
|
||||
|
||||
public function scopeReleased($q) {
|
||||
public function scopeReleased($q)
|
||||
{
|
||||
return $q->where('status', 'RELEASED');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
class Estimate extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes, BelongsToTenant;
|
||||
use BelongsToTenant, HasFactory, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
class EstimateItem extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes, BelongsToTenant;
|
||||
use BelongsToTenant, HasFactory, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\MainRequest;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
use App\Models\Commons\File;
|
||||
use App\Models\Commons\Tag;
|
||||
use App\Models\Qualitys\Lot;
|
||||
use App\Traits\ModelTrait;
|
||||
use App\Traits\BelongsToTenant;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use App\Traits\ModelTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
@@ -16,7 +15,7 @@
|
||||
*/
|
||||
class Material extends Model
|
||||
{
|
||||
use SoftDeletes, ModelTrait, BelongsToTenant;
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
|
||||
@@ -15,7 +15,7 @@ class MaterialReceipt extends Model
|
||||
protected $fillable = [
|
||||
'material_id', 'receipt_date', 'lot_number', 'received_qty', 'unit',
|
||||
'supplier_name', 'manufacturer_name', 'purchase_price_excl_vat',
|
||||
'weight_kg', 'status_code', 'is_inspection', 'inspection_date', 'remarks'
|
||||
'weight_kg', 'status_code', 'is_inspection', 'inspection_date', 'remarks',
|
||||
];
|
||||
|
||||
// 자재 마스터
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, Notifiable, SoftDeletes, ModelTrait, HasRoles;
|
||||
use HasApiTokens, HasRoles, ModelTrait, Notifiable, SoftDeletes;
|
||||
|
||||
protected $guard_name = 'api'; // ★ 중요: 권한/역할 가드 통일
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
class UserMenuPermission extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id', 'menu_id', 'access', 'read', 'write', 'export', 'approve'
|
||||
'user_id', 'menu_id', 'access', 'read', 'write', 'export', 'approve',
|
||||
];
|
||||
|
||||
public function user()
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
*/
|
||||
class UserRole extends Model
|
||||
{
|
||||
use SoftDeletes, BelongsToTenant;
|
||||
use BelongsToTenant, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'user_id', 'tenant_id', 'role_id', 'assigned_at'
|
||||
'user_id', 'tenant_id', 'role_id', 'assigned_at',
|
||||
];
|
||||
|
||||
public function user()
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
*/
|
||||
class UserTenant extends Model
|
||||
{
|
||||
use SoftDeletes, ModelTrait, BelongsToTenant;
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'user_id', 'tenant_id', 'is_active', 'is_default', 'joined_at', 'left_at'
|
||||
'user_id', 'tenant_id', 'is_active', 'is_default', 'joined_at', 'left_at',
|
||||
];
|
||||
|
||||
protected $guarded = [
|
||||
|
||||
@@ -18,7 +18,7 @@ class Order extends Model
|
||||
protected $fillable = [
|
||||
'tenant_id', 'order_no', 'order_type_code', 'status_code', 'category_code', 'product_id',
|
||||
'received_at', 'writer_id', 'client_id', 'client_contact', 'site_name', 'quantity', 'delivery_date',
|
||||
'delivery_method_code', 'memo'
|
||||
'delivery_method_code', 'memo',
|
||||
];
|
||||
|
||||
// 상세(라인)
|
||||
|
||||
@@ -13,7 +13,7 @@ class OrderHistory extends Model
|
||||
protected $table = 'order_histories';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'order_id', 'history_type', 'content', 'created_by'
|
||||
'tenant_id', 'order_id', 'history_type', 'content', 'created_by',
|
||||
];
|
||||
|
||||
public function order()
|
||||
|
||||
@@ -17,7 +17,7 @@ class OrderItem extends Model
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'order_id', 'serial_no', 'product_id', 'quantity',
|
||||
'status_code', 'design_code', 'remarks', 'attributes'
|
||||
'status_code', 'design_code', 'remarks', 'attributes',
|
||||
];
|
||||
|
||||
// 투입 구성(자재/BOM 등)
|
||||
|
||||
@@ -17,7 +17,7 @@ class OrderItemComponent extends Model
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'order_item_id', 'component_type', 'component_id', 'quantity',
|
||||
'unit', 'price', 'remarks', 'created_by', 'updated_by'
|
||||
'unit', 'price', 'remarks', 'created_by', 'updated_by',
|
||||
];
|
||||
|
||||
public function orderItem()
|
||||
|
||||
@@ -13,7 +13,7 @@ class OrderVersion extends Model
|
||||
protected $table = 'order_versions';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'order_id', 'version_no', 'version_type', 'status_code', 'changed_fields', 'created_by', 'change_note'
|
||||
'tenant_id', 'order_id', 'version_no', 'version_type', 'status_code', 'changed_fields', 'created_by', 'change_note',
|
||||
];
|
||||
|
||||
public function order()
|
||||
|
||||
@@ -11,6 +11,7 @@ class PermissionOverride extends Model
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'permission_overrides';
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected $casts = [
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
class Role extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'tenant_id', 'name', 'description'
|
||||
'tenant_id', 'name', 'description',
|
||||
];
|
||||
|
||||
public function menuPermissions()
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class RoleMenuPermission extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'role_id', 'menu_id', 'access', 'read', 'write', 'export', 'approve'
|
||||
'role_id', 'menu_id', 'access', 'read', 'write', 'export', 'approve',
|
||||
];
|
||||
|
||||
public function role()
|
||||
|
||||
@@ -2,16 +2,17 @@
|
||||
|
||||
namespace App\Models\Products;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Traits\BelongsToTenant;
|
||||
use App\Traits\ModelTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @mixin IdeHelperCommonCode
|
||||
*/
|
||||
class CommonCode extends Model
|
||||
{
|
||||
use SoftDeletes, BelongsToTenant, ModelTrait;
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $table = 'common_codes';
|
||||
|
||||
@@ -24,7 +25,7 @@ class CommonCode extends Model
|
||||
'attributes',
|
||||
'description',
|
||||
'is_active',
|
||||
'sort_order'
|
||||
'sort_order',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
|
||||
@@ -12,12 +12,16 @@
|
||||
class Part extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = ['tenant_id', 'code', 'name', 'category_id', 'part_type_id', 'unit', 'attributes', 'description', 'is_active'];
|
||||
|
||||
public function category() {
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(CommonCode::class, 'category_id');
|
||||
}
|
||||
public function partType() {
|
||||
|
||||
public function partType()
|
||||
{
|
||||
return $this->belongsTo(CommonCode::class, 'part_type_id');
|
||||
}
|
||||
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
use SoftDeletes, BelongsToTenant, ModelTrait;
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'code', 'name', 'unit', 'category_id',
|
||||
'product_type', // 라벨/분류용
|
||||
'attributes', 'description',
|
||||
'is_sellable', 'is_purchasable', 'is_producible', 'is_active',
|
||||
'created_by','updated_by'
|
||||
'created_by', 'updated_by',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
@@ -35,7 +35,10 @@ class Product extends Model
|
||||
];
|
||||
|
||||
// 분류
|
||||
public function category() { return $this->belongsTo(Category::class, 'category_id'); }
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class, 'category_id');
|
||||
}
|
||||
|
||||
// BOM (자기참조) — 라인 모델 경유
|
||||
public function componentLines()
|
||||
@@ -67,12 +70,34 @@ public function parents()
|
||||
}
|
||||
|
||||
// 파일 / 태그 (폴리모픽)
|
||||
public function files() { return $this->morphMany(File::class, 'fileable'); }
|
||||
public function tags() { return $this->morphToMany(Tag::class, 'taggable'); }
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany(File::class, 'fileable');
|
||||
}
|
||||
|
||||
public function tags()
|
||||
{
|
||||
return $this->morphToMany(Tag::class, 'taggable');
|
||||
}
|
||||
|
||||
// 스코프
|
||||
public function scopeType($q, string $type) { return $q->where('product_type', $type); }
|
||||
public function scopeSellable($q) { return $q->where('is_sellable', 1); }
|
||||
public function scopePurchasable($q) { return $q->where('is_purchasable', 1); }
|
||||
public function scopeProducible($q) { return $q->where('is_producible', 1); }
|
||||
public function scopeType($q, string $type)
|
||||
{
|
||||
return $q->where('product_type', $type);
|
||||
}
|
||||
|
||||
public function scopeSellable($q)
|
||||
{
|
||||
return $q->where('is_sellable', 1);
|
||||
}
|
||||
|
||||
public function scopePurchasable($q)
|
||||
{
|
||||
return $q->where('is_purchasable', 1);
|
||||
}
|
||||
|
||||
public function scopeProducible($q)
|
||||
{
|
||||
return $q->where('is_producible', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
namespace App\Models\Products;
|
||||
|
||||
use App\Models\Materials\Material;
|
||||
use App\Traits\BelongsToTenant;
|
||||
use App\Traits\ModelTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Traits\ModelTrait;
|
||||
use App\Traits\BelongsToTenant;
|
||||
|
||||
class ProductComponent extends Model
|
||||
{
|
||||
use SoftDeletes, ModelTrait, BelongsToTenant;
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $table = 'product_components';
|
||||
|
||||
@@ -57,6 +57,7 @@ public function referencedItem()
|
||||
} elseif ($this->ref_type === 'MATERIAL') {
|
||||
return $this->belongsTo(Material::class, 'ref_id');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Models\Qualitys;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
@@ -16,7 +16,9 @@ public function apply(Builder $builder, Model $model)
|
||||
{
|
||||
|
||||
// artisan migrate 등은 제외
|
||||
if (app()->runningInConsole()) return;
|
||||
if (app()->runningInConsole()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// request 헬퍼 사용 → request 인스턴스를 명시적으로 주입받아 사용해야 함
|
||||
$request = app(Request::class);
|
||||
|
||||
@@ -13,10 +13,12 @@ class SiteAdmin extends Model
|
||||
use UppercaseAttributes; // 테이블 컬럼명 대문자 처리
|
||||
|
||||
protected $table = 'SITE_ADMIN';
|
||||
|
||||
protected $primaryKey = 'UNO';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'UNO', 'LEVEL'. 'COMMENT'
|
||||
'UNO', 'LEVEL'.'COMMENT',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -3,20 +3,22 @@
|
||||
namespace App\Models\Tenants;
|
||||
|
||||
use App\Models\Members\User;
|
||||
use App\Models\Permissions\PermissionOverride;
|
||||
use App\Models\Tenants\Pivots\DepartmentUser;
|
||||
use App\Traits\ModelTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
use App\Traits\ModelTrait;
|
||||
use App\Models\Tenants\Pivots\DepartmentUser;
|
||||
use App\Models\Permissions\PermissionOverride;
|
||||
|
||||
class Department extends Model
|
||||
{
|
||||
use HasRoles, ModelTrait; // 부서도 권한/역할을 가짐
|
||||
|
||||
protected $table = 'departments';
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected $casts = [
|
||||
'tenant_id' => 'int',
|
||||
'parent_id' => 'int',
|
||||
@@ -25,7 +27,7 @@ class Department extends Model
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'deleted_by','deleted_at'
|
||||
'deleted_by', 'deleted_at',
|
||||
];
|
||||
|
||||
// 스파티 가드명(프로젝트 설정에 맞게 조정)
|
||||
|
||||
@@ -13,14 +13,15 @@ class Payment extends Model
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'subscription_id', 'amount', 'payment_method', 'transaction_id', 'paid_at', 'status', 'memo'
|
||||
'subscription_id', 'amount', 'payment_method', 'transaction_id', 'paid_at', 'status', 'memo',
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'paid_at',
|
||||
];
|
||||
|
||||
public function subscription() {
|
||||
public function subscription()
|
||||
{
|
||||
return $this->belongsTo(Subscription::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
*/
|
||||
class DepartmentUser extends Model
|
||||
{
|
||||
use SoftDeletes, BelongsToTenant, ModelTrait;
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $table = 'department_user';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'department_id', 'user_id', 'is_primary', 'joined_at', 'left_at',
|
||||
];
|
||||
|
||||
@@ -22,7 +22,8 @@ class Plan extends Model
|
||||
'price' => 'float',
|
||||
];
|
||||
|
||||
public function subscriptions() {
|
||||
public function subscriptions()
|
||||
{
|
||||
return $this->hasMany(Subscription::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,15 +20,18 @@ class Subscription extends Model
|
||||
'started_at', 'ended_at',
|
||||
];
|
||||
|
||||
public function tenant() {
|
||||
public function tenant()
|
||||
{
|
||||
return $this->belongsTo(Tenant::class);
|
||||
}
|
||||
|
||||
public function plan() {
|
||||
public function plan()
|
||||
{
|
||||
return $this->belongsTo(Plan::class);
|
||||
}
|
||||
|
||||
public function payments() {
|
||||
public function payments()
|
||||
{
|
||||
return $this->hasMany(Payment::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
class Tenant extends Model
|
||||
{
|
||||
use SoftDeletes, ModelTrait;
|
||||
use ModelTrait, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'company_name',
|
||||
|
||||
@@ -18,7 +18,9 @@ protected function actions(): array
|
||||
|
||||
public function created(Menu $menu): void
|
||||
{
|
||||
if (!$this->shouldHandle($menu)) return;
|
||||
if (! $this->shouldHandle($menu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setTeam((int) $menu->tenant_id);
|
||||
$this->ensurePermissions($menu);
|
||||
@@ -33,7 +35,9 @@ public function updated(Menu $menu): void
|
||||
|
||||
public function deleted(Menu $menu): void
|
||||
{
|
||||
if (!$this->shouldHandle($menu)) return;
|
||||
if (! $this->shouldHandle($menu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setTeam((int) $menu->tenant_id);
|
||||
$this->removePermissions($menu);
|
||||
@@ -42,7 +46,9 @@ public function deleted(Menu $menu): void
|
||||
|
||||
public function restored(Menu $menu): void
|
||||
{
|
||||
if (!$this->shouldHandle($menu)) return;
|
||||
if (! $this->shouldHandle($menu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setTeam((int) $menu->tenant_id);
|
||||
$this->ensurePermissions($menu);
|
||||
@@ -51,7 +57,9 @@ public function restored(Menu $menu): void
|
||||
|
||||
public function forceDeleted(Menu $menu): void
|
||||
{
|
||||
if (!$this->shouldHandle($menu)) return;
|
||||
if (! $this->shouldHandle($menu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setTeam((int) $menu->tenant_id);
|
||||
$this->removePermissions($menu);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user