laon order
This commit is contained in:
@@ -202,6 +202,9 @@ function localeAppUrl(): string
|
||||
return config('app.locale_app.url');
|
||||
}
|
||||
|
||||
/**
|
||||
* Original quality :D
|
||||
*/
|
||||
function convertToOriginalFormat($apiPrice)
|
||||
{
|
||||
$originalPrice = intval($apiPrice) / 100;
|
||||
@@ -209,6 +212,9 @@ function convertToOriginalFormat($apiPrice)
|
||||
return number_format($originalPrice, 2, '.', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Date day mf
|
||||
*/
|
||||
function lastDayOfMonth($month, $year)
|
||||
{
|
||||
$date = new DateTime("$year-$month-01");
|
||||
@@ -216,3 +222,17 @@ function lastDayOfMonth($month, $year)
|
||||
|
||||
return $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get index by value from array
|
||||
*/
|
||||
function indexByValue($value, $array)
|
||||
{
|
||||
for ($i = 0; $i < count($array); $i++) {
|
||||
if ($array[$i] == $value) {
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -41,16 +41,14 @@ class LoanOrderController extends Controller
|
||||
$months = DateHelperRepository::monthsAsNumber();
|
||||
$years = DateHelperRepository::yearsUntil();
|
||||
|
||||
info($request->all());
|
||||
$data['card_month'] = indexByValue($request->card_month, $months);
|
||||
$data['card_year'] = indexByValue($request->card_year, $years);
|
||||
|
||||
$data['card_month'] = array_key_exists($request->card_month, $months) ? $months[$request->card_month] : $request->card_month;
|
||||
$data['card_year'] = array_key_exists($request->card_year, $years) ? $years[$request->card_year] : $request->card_year;
|
||||
$data['guarantor_card_month'] = indexByValue($request->guarantor_card_month, $months);
|
||||
$data['guarantor_card_year'] = indexByValue($request->guarantor_card_year, $years);
|
||||
|
||||
$data['guarantor_card_month'] = array_key_exists($request->guarantor_card_month, $months) ? $months[$request->guarantor_card_month] : $request->guarantor_card_month;
|
||||
$data['guarantor_card_year'] = array_key_exists($request->guarantor_card_year, $years) ? $years[$request->guarantor_card_year] : $request->guarantor_card_year;
|
||||
|
||||
$data['guarantor_2_card_month'] = array_key_exists($request->guarantor_2_card_month, $months) ? $months[$request->guarantor_2_card_month] : $request->guarantor_2_card_month;
|
||||
$data['guarantor_2_card_year'] = array_key_exists($request->guarantor_2_card_year, $years) ? $years[$request->guarantor_2_card_year] : $request->guarantor_2_card_year;
|
||||
$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([
|
||||
...$data,
|
||||
|
||||
Reference in New Issue
Block a user