feat : Main Request 모델 추가, Enum 클래스 추가
- Main Request가 모든 공정을 관리하는 형태
This commit is contained in:
44
app/Repositories/MainRequestRepository.php
Normal file
44
app/Repositories/MainRequestRepository.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\MainRequest;
|
||||
use App\Models\MainRequestEstimate;
|
||||
use App\Models\MainRequestOrder;
|
||||
use App\Models\MainRequestFlow;
|
||||
|
||||
class MainRequestRepository
|
||||
{
|
||||
// 메인 업무 단건 조회
|
||||
public function find($id)
|
||||
{
|
||||
return MainRequest::with(['flows', 'estimates', 'orders'])->find($id);
|
||||
}
|
||||
|
||||
// 견적 생성
|
||||
public function createEstimate($mainRequestId, array $data)
|
||||
{
|
||||
$data['main_request_id'] = $mainRequestId;
|
||||
return MainRequestEstimate::create($data);
|
||||
}
|
||||
|
||||
// 주문 생성
|
||||
public function createOrder($mainRequestId, array $data)
|
||||
{
|
||||
$data['main_request_id'] = $mainRequestId;
|
||||
return MainRequestOrder::create($data);
|
||||
}
|
||||
|
||||
// 이력(Flow) 기록
|
||||
public function addFlow($mainRequestId, $flowableType, $flowableId, $status, $action, $actorId, $content = null)
|
||||
{
|
||||
return MainRequestFlow::create([
|
||||
'main_request_id' => $mainRequestId,
|
||||
'flowable_type' => $flowableType,
|
||||
'flowable_id' => $flowableId,
|
||||
'status_code' => $status,
|
||||
'action' => $action,
|
||||
'actor_id' => $actorId,
|
||||
'content' => $content,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user