This commit is contained in:
nurmuhammet committed 2024-09-24 23:10:46 +05:00
1 parent e7374afdb3
commit 4ccb8b4347
5 files changed
+154 -5

No files matched your search

@@ -6,6 +6,7 @@
use App\Models\Order\Loan\LoanOrder;
use App\Modules\LoanOrder\Controllers\Requests\LoanOrderStoreRequest;
use App\Modules\LoanOrder\Controllers\Resources\LoanOrderIndexResource;
use App\Repos\Order\OrderRepo;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -24,11 +25,20 @@ public function index(Request $request): JsonResponse
/**
* SAVE* Loan order.
*/
public function store(LoanOrderStoreRequest $request): void
public function store(LoanOrderStoreRequest $request): JsonResponse
{
// "user_id",
// "status",
// "notes",
LoanOrder::create(
$request->validated(),
...[
'user_id' => auth()->id(),
'status' => OrderRepo::PENDING,
'source' => OrderRepo::MOBILE_DEVICE,
]
);
return response()->json([
'message' => __('Successfully created'),
], 201);
}
/**
@@ -24,6 +24,13 @@ public function rules(): array
*/
'loan_type' => ['required', 'integer', Rule::exists('loan_types', 'id')],
/**
* Loan amount
*
* @example 20000
*/
'loan_amount' => ['required', 'integer', 'max:40000'],
/**
* Region (https://online.tbbank.gov.tm/api/base-app-enums)
*/
@@ -147,6 +154,34 @@ public function rules(): array
*/
'phone_home' => ['required', 'string', 'max:255'],
/**
* Card number
*
* @example 4434345434423442
*/
'card_number' => ['required', 'digits:16'],
/**
* Name on card
*
* @example 'Mahmyt Allaberdiyev'
*/
'card_name' => ['required', 'string', 'max:255'],
/**
* Card expiration month
*
* @example 06
*/
'card_month' => ['required'],
/**
* Card expiration year
*
* @example 2040
*/
'card_year' => ['required'],
/**
* Region (https://online.tbbank.gov.tm/api/base-app-enums)
*/
@@ -212,6 +247,103 @@ public function rules(): array
*/
'passport_four' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
/**
* Guarantor name
*
* @example Mahmyt
*/
'guarantor_name' => ['required', 'string', 'max:255'],
/**
* Guarantor surname
*
* @example Allaberdiev
*/
'guarantor_surname' => ['required', 'string', 'max:255'],
/**
* Guarantor surname
*
* @example Owezowic
*/
'guarantor_patronic_name' => ['required', 'string', 'max:255'],
/**
* Guarantor card number
*
* @example 4323344234423443
*/
'guarantor_card_number' => ['required', 'string', 'max:255'],
/**
* Guarantor name on card
*
* @example Mahmyt Allaberdiyev
*/
'guarantor_card_name' => ['required', 'string', 'max:255'],
/**
* Guarantor Card month
*
* @example 06
*/
'guarantor_card_month' => ['required', 'string', 'max:255'],
/**
* Guarantor Card year
*
* @example 2040
*/
'guarantor_card_year' => ['required', 'string', 'max:255'],
/**
* 2. Guarantor name
*
* @example Mahmyt
*/
'guarantor_2_name' => ['required', 'string', 'max:255'],
/**
* 2. Guarantor surname
*
* @example Allaberdiev
*/
'guarantor_2_surname' => ['required', 'string', 'max:255'],
/**
* 2. Guarantor patronic name
*
* @example Owezowich
*/
'guarantor_2_patronic_name' => ['nullable', 'string', 'max:255'],
/**
* 2. Guarantor card number
*
* @example 4323344234423443
*/
'guarantor_2_card_number' => [],
/**
* 2. Guarantor name on card
*
* @example Mahmyt Allaberdiyev
*/
'guarantor_2_card_name' => [],
/**
* 2. Guarantor Card month
*
* @example 06
*/
'guarantor_2_card_month' => [],
/**
* 2. Guarantor Card year
*
* @example 2040
*/
'guarantor_2_card_year' => [],
];
}
}
@@ -2,7 +2,6 @@
namespace App\Nova\Resources\Order\Loan\Concerns;
use App\Modules\DateHelper\Repositories\DateHelperRepository;
use App\Nova\Resources\Branch\Branch;
use App\Nova\Resources\Order\Loan\LoanType;
use App\Nova\Resources\System\Location\Province;
+3
View File
@@ -17,6 +17,9 @@ public static function values(): Collection|array
return LoanType::where('active', true)->pluck('name', 'id');
}
/**
* Only guarantor
*/
public static function onlyGuarantor(): Collection|array
{
return LoanType::where('active', true)->where('id', static::loanTypeGuarantorId())->pluck('name', 'id');
+5
View File
@@ -29,6 +29,11 @@ class OrderRepo
*/
public const CANCELLED = 'cancelled';
/**
* Mobile device
*/
public const MOBILE_DEVICE = 'mobile';
/**
* Default status value
*/