latest
This commit is contained in:
@@ -96,11 +96,33 @@ class CustomersController extends Controller
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$customer = $this->customerService->createNewCustomer($request);
|
||||
dd($request);
|
||||
if($request->warganegara){
|
||||
$warganegara = 'Y';
|
||||
}else{
|
||||
$warganegara = 'N';
|
||||
}
|
||||
if($request->bumiputera){
|
||||
$bumiputera = 'Y';
|
||||
}else{
|
||||
$bumiputera = 'N';
|
||||
}
|
||||
if($request->jantina == 'Lelaki'){
|
||||
$jantina = 'L';
|
||||
}elseif($request->jantina == 'Perampuan'){
|
||||
$jantina = 'P';
|
||||
}
|
||||
$split_date = explode('/',$request->tarikh_lahir);
|
||||
$tarikh_lahir = $split_date[2].'-'.$split_date[1].'-'.$split_date[0];
|
||||
$auth_user = Auth::user();
|
||||
$latest_customer = Http::get(config('api.url') . '/api/customers/latest/' . $auth_user['cawangan'])->json();
|
||||
|
||||
$customer_info = Customer::where('noic','=',$request['noic'])->first();
|
||||
$nosiri_latest = $latest_customer['nosiri']+1;
|
||||
$count = sprintf("%08d", $nosiri_latest);
|
||||
|
||||
$no_pelanggan = $request->bangsa . substr($request->noic,6,2).'-'.$count;
|
||||
// dd($tarikh_lahir);
|
||||
|
||||
// dd($customer_info);
|
||||
Session::put('customer_info',$customer_info);
|
||||
return redirect()->route('customer_info')->with( ['customer_info' => $customer_info] );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user