- 컨트롤러와 서비스에서 각각 래핑 후 결과 전달됨으로 이중 래핑되고 있음 -> 서비스에서 래핑하는 부분을 컨트롤러로 옮겨서 컨트롤러에서만 한번 래핑하는 걸로 수정
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Helpers\ApiResponse;
|
|
use Illuminate\Support\Facades\DB;
|
|
use App\Models\Products\CommonCode;
|
|
use App\Models\Materials\Material;
|
|
|
|
class MeterialService
|
|
{
|
|
public static function getMeterials()
|
|
{
|
|
$query = new Material();
|
|
return $query->get();
|
|
}
|
|
|
|
public static function setMeterial()
|
|
{
|
|
$query = DB::table('COM_CODE')
|
|
->select(['CODE_TP_ID', 'CODE_ID', 'CODE_VAL', 'CODE_DESC', 'USE_YN']);
|
|
return $query->get();
|
|
}
|
|
|
|
public static function getMeterial(int $id)
|
|
{
|
|
$query = Material::find($id);
|
|
return $query->get();
|
|
}
|
|
|
|
public static function updateMeterial(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 destoryMeterial(int $id)
|
|
{
|
|
$query = DB::table('COM_CODE')
|
|
->select(['CODE_TP_ID', 'CODE_ID', 'CODE_VAL', 'CODE_DESC', 'USE_YN']);
|
|
return $query->get();
|
|
}
|
|
}
|