wip
This commit is contained in:
@@ -49,22 +49,8 @@ class LoanOrderController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function store(LoanOrderStoreRequest $request): JsonResponse
|
public function store(LoanOrderStoreRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
Log::channel('form_logs')->info('loan-order-store-request', $request->all());
|
|
||||||
|
|
||||||
$data = $request->validated();
|
$data = $request->validated();
|
||||||
|
|
||||||
$months = DateHelperRepository::monthsAsNumber();
|
|
||||||
$years = DateHelperRepository::yearsUntil();
|
|
||||||
|
|
||||||
$data['card_month'] = indexByValue($request->card_month, $months);
|
|
||||||
$data['card_year'] = indexByValue($request->card_year, $years);
|
|
||||||
|
|
||||||
$data['guarantor_card_month'] = indexByValue($request->guarantor_card_month, $months);
|
|
||||||
$data['guarantor_card_year'] = indexByValue($request->guarantor_card_year, $years);
|
|
||||||
|
|
||||||
$data['guarantor_2_card_month'] = indexByValue($request->guarantor_2_card_month, $months);
|
|
||||||
$data['guarantor_2_card_year'] = indexByValue($request->guarantor_2_card_year, $years);
|
|
||||||
|
|
||||||
LoanOrder::forceCreate([
|
LoanOrder::forceCreate([
|
||||||
...$data,
|
...$data,
|
||||||
...[
|
...[
|
||||||
@@ -119,37 +105,6 @@ class LoanOrderController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function update(LoanOrderUpdateRequest $request, LoanOrder $loanOrder): JsonResponse
|
public function update(LoanOrderUpdateRequest $request, LoanOrder $loanOrder): JsonResponse
|
||||||
{
|
{
|
||||||
Log::channel('form_logs')->info('loan-order-update-request', $request->all());
|
|
||||||
|
|
||||||
$data = $request->all();
|
|
||||||
|
|
||||||
$months = DateHelperRepository::monthsAsNumber();
|
|
||||||
$years = DateHelperRepository::yearsUntil();
|
|
||||||
|
|
||||||
if ($request->filled('card_month')) {
|
|
||||||
$data['card_month'] = indexByValue($request->card_month, $months);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($request->filled('card_year')) {
|
|
||||||
$data['card_year'] = indexByValue($request->card_year, $years);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($request->filled('guarantor_card_month')) {
|
|
||||||
$data['guarantor_card_month'] = indexByValue($request->guarantor_card_month, $months);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($request->filled('guarantor_card_year')) {
|
|
||||||
$data['guarantor_card_year'] = indexByValue($request->guarantor_card_year, $years);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($request->filled('guarantor_2_card_month')) {
|
|
||||||
$data['guarantor_2_card_month'] = indexByValue($request->guarantor_2_card_month, $months);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($request->filled('guarantor_2_card_year')) {
|
|
||||||
$data['guarantor_2_card_year'] = indexByValue($request->guarantor_2_card_year, $years);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = array_merge($request->all(), $this->uploadedFiles($request));
|
$data = array_merge($request->all(), $this->uploadedFiles($request));
|
||||||
|
|
||||||
Model::unguarded(function () use ($loanOrder, $data) {
|
Model::unguarded(function () use ($loanOrder, $data) {
|
||||||
|
|||||||
Reference in New Issue
Block a user