Files
sam-api/app/Services/ModelService.php
hskwon 43e4c507a7 fix : 결과 전달시 두번 래핑되는 부분 수정
- 컨트롤러와 서비스에서 각각 래핑 후 결과 전달됨으로 이중 래핑되고 있음
  -> 서비스에서 래핑하는 부분을 컨트롤러로 옮겨서 컨트롤러에서만 한번 래핑하는 걸로 수정
2025-08-19 12:41:17 +09:00

47 lines
1.1 KiB
PHP

<?php
namespace App\Services;
use App\Helpers\ApiResponse;
use App\Models\Products\Bom;
use Illuminate\Support\Facades\DB;
use App\Models\Products\CommonCode;
use App\Models\Products\Product;
class ModelService
{
public static function getModels()
{
$query = new Product();
return $query->get();
}
public static function setModel()
{
$query = DB::table('COM_CODE')
->select(['CODE_TP_ID', 'CODE_ID', 'CODE_VAL', 'CODE_DESC', 'USE_YN']);
return $query->get();
}
public static function getModel(int $id)
{
$query = Bom::find($id);
return $query->get();
}
public static function updateModel(int $id)
{
$query = DB::table('COM_CODE')
->select(['CODE_TP_ID', 'CODE_ID', 'CODE_VAL', 'CODE_DESC', 'USE_YN']);
return $query->get();
}
public static function destoryModel(int $id)
{
$query = DB::table('COM_CODE')
->select(['CODE_TP_ID', 'CODE_ID', 'CODE_VAL', 'CODE_DESC', 'USE_YN']);
return $query->get();
}
}