change strcture controller becuse repet some code in 3 file and get same code in model

This commit is contained in:
2025-11-09 15:25:00 +03:30
parent a619efb123
commit 40513d72b8
7 changed files with 250 additions and 492 deletions

View File

@@ -25,8 +25,6 @@ use App\Http\Traits\ApiResponse;
use App\Models\Harim;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Throwable;
class GeneralManagerController extends Controller
@@ -48,209 +46,104 @@ class GeneralManagerController extends Controller
return response()->json($data);
}
/**
* @throws Throwable
*/
public function rejectRequest(RejectRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::CONFIRM->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::EMKAN_PAZIR_NEMEBASHAD->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
RejectRequestEvent::dispatch($harim);
});
$harim->updateStateWithHistory(
action:HarimAction::CONFIRM->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::EMKAN_PAZIR_NEMEBASHAD->value,
'state_name' => HarimStates::EMKAN_PAZIR_NEMEBASHAD->label(),
]
);
RejectRequestEvent::dispatch($harim);
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function referRequest(ReferRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::REFER->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous-state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'export_description' => $request->export_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_TAVASOT_MOAVEN->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
});
$harim->updateStateWithHistory(
action:HarimAction::REFER->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_TAVASOT_MOAVEN->value,
'state_name' => HarimStates::BARESI_TAVASOT_MOAVEN->label(),
]
);
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function referFile(ReferFileRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::REFER->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous-state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'export_description' => $request->export_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
});
$harim->updateStateWithHistory(
action:HarimAction::REFER->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->value,
'state_name' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->label(),
]
);
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function confirmRoadAccessNeed(ConfirmRoadAccessNeedRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::CONFIRM->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::ERSAL_BE_PANJAREH_VAHED_NIAZ_BE_RAH_DASTRASI->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
ConfirmRoadAccessNeedEvent::dispatch($harim);
});
$harim->updateStateWithHistory(
action:HarimAction::CONFIRM->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::ERSAL_BE_PANJAREH_VAHED_NIAZ_BE_RAH_DASTRASI->value,
'state_name' => HarimStates::ERSAL_BE_PANJAREH_VAHED_NIAZ_BE_RAH_DASTRASI->label(),
]
);
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function confirmNoRoadAccessNeed(ConfirmNoRoadAccessNeedRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::CONFIRM->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::ERSAL_BE_PANJAREH_VAHED_BEDONEH_NIAZ_BE_RAH_DASTRASI->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
ConfirmNoRoadAccessNeedEvent::dispatch($harim);
});
$harim->updateStateWithHistory(
action:HarimAction::CONFIRM->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::ERSAL_BE_PANJAREH_VAHED_BEDONEH_NIAZ_BE_RAH_DASTRASI->value,
'state_name' => HarimStates::ERSAL_BE_PANJAREH_VAHED_BEDONEH_NIAZ_BE_RAH_DASTRASI->label(),
]
);
ConfirmNoRoadAccessNeedEvent::dispatch($harim);
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function confirmRoadAccessEditNeed(ConfirmRoadAccessEditNeedRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::CONFIRM->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::UPDATE_RAHE_DASTRASI_BARGOZARE_SHODE->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
ConfirmRoadAccessEditNeedEvent::dispatch($harim);
});
$harim->updateStateWithHistory(
action:HarimAction::CONFIRM->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::UPDATE_RAHE_DASTRASI_BARGOZARE_SHODE->value,
'state_name' => HarimStates::UPDATE_RAHE_DASTRASI_BARGOZARE_SHODE->label(),
]
);
ConfirmRoadAccessEditNeedEvent::dispatch($harim);
return $this->successResponse();
}
/**
* @throws \Throwable
*/
public function confirmGuaranteeLetterNeed(ConfirmGuaranteeLetterNeedRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::CONFIRM->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::ARSE_VA_AYAN_NAHAI->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
ConfirmGuaranteeLetterNeedEvent::dispatch($harim);
});
$harim->updateStateWithHistory(
action:HarimAction::CONFIRM->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::ARSE_VA_AYAN_NAHAI->value,
'state_name' => HarimStates::ARSE_VA_AYAN_NAHAI->label(),
]
);
ConfirmGuaranteeLetterNeedEvent::dispatch($harim);
return $this->successResponse();
}
@@ -260,60 +153,33 @@ class GeneralManagerController extends Controller
return $this->successResponse($harim->load('histories'));
}
/**
* @throws Throwable
*/
public function referPaymentRequest(ReferPaymentRequest $request, Harim $harim): JsonResponse
public function referPayment(ReferPaymentRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::REFER->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous-state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'export_description' => $request->export_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MOAVEN->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
});
$harim->updateStateWithHistory(
action:HarimAction::REFER->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MOAVEN->value,
'state_name' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MOAVEN->label(),
]
);
ConfirmGuaranteeLetterNeedEvent::dispatch($harim);
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function confirmPayment(ConfirmPaymentRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::CONFIRM->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::ETMAM_FARAYAND->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
});
$harim->updateStateWithHistory(
action:HarimAction::CONFIRM->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::ETMAM_FARAYAND->value,
'state_name' => HarimStates::ETMAM_FARAYAND->label(),
]
);
ConfirmGuaranteeLetterNeedEvent::dispatch($harim);
return $this->successResponse();
}
}

View File

@@ -42,178 +42,100 @@ class HarimOfficeController extends Controller
return response()->json($data);
}
/**
* @throws Throwable
*/
public function rejectRequest(RejectRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::NO->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_TAVASOT_MOAVEN->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
$harim->updateStateWithHistory(
action:HarimAction::NO->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_TAVASOT_MOAVEN->value,
'state_name' => HarimStates::BARESI_TAVASOT_MOAVEN->label(),
'is_possible' => false,
]);
});
]
);
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function referRequest(ReferRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::REFER->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_EDARE_SHAHRESTAN->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
});
$harim->updateStateWithHistory(
action:HarimAction::REFER->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_EDARE_SHAHRESTAN->value,
'state_name' => HarimStates::BARESI_EDARE_SHAHRESTAN->label(),
]
);
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function needRoadAccess(NeedRoadAccessRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::YES->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_TAVASOT_MOAVEN->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
$harim->updateStateWithHistory(
action:HarimAction::YES->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_TAVASOT_MOAVEN->value,
'state_name' => HarimStates::BARESI_TAVASOT_MOAVEN->label(),
'is_possible' => true,
'need_access_road' => true,
'need_payment' => $request->need_payment,
]);
});
]
);
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function withoutRoadAccess(WithoutRoadAccessRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::YES->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_TAVASOT_MOAVEN->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
$harim->updateStateWithHistory(
action:HarimAction::YES->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_TAVASOT_MOAVEN->value,
'state_name' => HarimStates::BARESI_TAVASOT_MOAVEN->label(),
'is_possible' => true,
'need_access_road' => false,
'need_payment' => $request->need_payment,
]);
});
]
);
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function fileAccepted(FileAcceptedRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::YES->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
$harim->updateStateWithHistory(
action:HarimAction::YES->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->value,
'state_name' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->label(),
'access_road_allowed' => true,
]);
});
]
);
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function fileRejected(FileRejectedRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::NO->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
$harim->updateStateWithHistory(
action:HarimAction::YES->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->value,
'state_name' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MOAVEN->label(),
'access_road_allowed' => false,
]);
});
]
);
return $this->successResponse();
}
public function show(ShowRequest $request, Harim $harim): JsonResponse
{
return $this->successResponse($harim->load('histories'));
@@ -230,34 +152,21 @@ class HarimOfficeController extends Controller
]);
}
/**
* @throws Throwable
*/
public function computingPayment(ComputingPaymentRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::CONFIRM->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MOAVEN->value;
$harim->update([
$harim->updateStateWithHistory(
action:HarimAction::CONFIRM->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MOAVEN->value,
'state_name' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MOAVEN->label(),
'traffic' => $request->traffic,
'position' => $request->position,
'final_plan_space' => $request->final_plan_space,
'road_type' => $request->road_type,
'payment_amount' => $request->payment_amount,
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
});
]
);
return $this->successResponse();
}

View File

@@ -34,29 +34,17 @@ class ProvinceOfficeController extends Controller
return response()->json($data);
}
public function feedback(FeedBackRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::FEEDBACK->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_TAVASOT_DAFTAR_HARIM->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
$harim->updateStateWithHistory(
action:HarimAction::FEEDBACK->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_TAVASOT_DAFTAR_HARIM->value,
'state_name' => HarimStates::BARESI_TAVASOT_DAFTAR_HARIM->label(),
'forbidden_area' => $request->input('forbidden_area'),
]);
});
]
);
return $this->successResponse();
}

View File

@@ -17,8 +17,6 @@ use App\Http\Traits\ApiResponse;
use App\Models\Harim;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Throwable;
class TechnicalDeputyController extends Controller
@@ -40,113 +38,58 @@ class TechnicalDeputyController extends Controller
return response()->json($data);
}
/**
* @throws \Throwable
*/
public function confirmRequest(ConfirmRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::CONFIRM->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_TAVASOT_MODIR_KOL->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
});
$harim->updateStateWithHistory(
action:HarimAction::CONFIRM->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_TAVASOT_MODIR_KOL->value,
'state_name' => HarimStates::BARESI_TAVASOT_MODIR_KOL->label(),
]
);
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function referRequest(ReferRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::REFER->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_TAVASOT_DAFTAR_HARIM->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
});
$harim->updateStateWithHistory(
action:HarimAction::REFER->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_TAVASOT_DAFTAR_HARIM->value,
'state_name' => HarimStates::BARESI_TAVASOT_DAFTAR_HARIM->label(),
]
);
return $this->successResponse();
}
/**
* @throws \Throwable
*/
public function confirmRoadAccess(ConfirmRoadAccessRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::CONFIRM->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MODIR_KOL->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
});
$harim->updateStateWithHistory(
action:HarimAction::CONFIRM->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MODIR_KOL->value,
'state_name' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_MODIR_KOL->label(),
]
);
return $this->successResponse();
}
/**
* @throws \Throwable
*/
public function referRoadAccess(ReferRoadAccessRequest $request, Harim $harim): JsonResponse
{
DB::transaction(function () use ($request, $harim) {
$action = HarimAction::REFER->value;
$harim->histories()->create([
'expert_id' => auth()->user()->id,
'previous_state_id' => $harim->state_id,
'previous_state_name' => $harim->state_name,
'expert_description' => $request->expert_description,
'action_id' => $action,
'action_name' => HarimAction::name($action),
]);
$state = HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->value;
$harim->update([
'state_id' => $state,
'state_name' => HarimStates::name($state),
]);
});
$harim->updateStateWithHistory(
action:HarimAction::REFER->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->value,
'state_name' => HarimStates::BARESI_RAHE_DASTRASI_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->label(),
]
);
return $this->successResponse();
}
@@ -155,4 +98,30 @@ class TechnicalDeputyController extends Controller
{
return $this->successResponse($harim->load('histories'));
}
public function referPayment(ReferPaymentRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
action:HarimAction::REFER->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_DAFTAR_HARIM->value,
'state_name' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_DAFTAR_HARIM->label(),
]
);
return $this->successResponse();
}
public function confirmPayment(ConfirmPaymentRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
action:HarimAction::CONFIRM->value,
description: $request->expert_description,
data: [
'state_id' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MODIR_KOL->value,
'state_name' => HarimStates::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MODIR_KOL->label(),
]
);
return $this->successResponse();
}
}