|
|
|
@@ -0,0 +1,53 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
namespace App\Http\Controllers\Web\ReceiptIssuingOrder; |
|
|
|
|
|
|
|
use App\Codes\UserRole; |
|
|
|
use App\Http\Controllers\Web\IParam; |
|
|
|
use App\Http\Controllers\Web\WebController; |
|
|
|
use App\Logic\ReceiptIssuingOrder\UpdateManager; |
|
|
|
use App\Models\User; |
|
|
|
use Illuminate\Http\JsonResponse; |
|
|
|
use Illuminate\Http\Request; |
|
|
|
|
|
|
|
class ChangeHandlerController extends WebController |
|
|
|
{ |
|
|
|
public function name(): string |
|
|
|
{ |
|
|
|
return "領収証発行依頼担当者変更"; |
|
|
|
} |
|
|
|
|
|
|
|
public function description(): string |
|
|
|
{ |
|
|
|
return "領収証発行依頼の担当者を変更する"; |
|
|
|
} |
|
|
|
|
|
|
|
public function __construct( |
|
|
|
protected ChangeHandlerParam $param, |
|
|
|
private UpdateManager $manager |
|
|
|
) { |
|
|
|
parent::__construct(); |
|
|
|
$this->middleware('auth:sanctum'); |
|
|
|
$this->roleAllow(UserRole::NORMAL_ADMIN); |
|
|
|
} |
|
|
|
|
|
|
|
protected function getParam(): IParam |
|
|
|
{ |
|
|
|
return $this->param; |
|
|
|
} |
|
|
|
|
|
|
|
protected function run(Request $request): JsonResponse |
|
|
|
{ |
|
|
|
$param = $this->param; |
|
|
|
|
|
|
|
// 変更先ユーザーの取得 |
|
|
|
$newHandler = User::findOrFail($param->handlerId); |
|
|
|
|
|
|
|
$this->manager->initById($param->id) |
|
|
|
->checkTimestamp($param->timestamp) |
|
|
|
->changeHandler($newHandler) |
|
|
|
->update(); |
|
|
|
|
|
|
|
return $this->successResponse(); |
|
|
|
} |
|
|
|
} |