ggwp
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Services\CustomerService;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class GadaianController extends Controller
|
||||
{
|
||||
@@ -18,12 +19,22 @@ class GadaianController extends Controller
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$curent_year = substr($current->year,2,2);
|
||||
$curent_month = sprintf("%02d", $current->month);
|
||||
$current_day = sprintf("%02d", $current->day);
|
||||
// dd($current_day);
|
||||
$noic = $request->noic;
|
||||
$customer_info = Http::get(config('api.url') . '/api/customers/'. $noic)->json();
|
||||
$customers_info = Http::get(config('api.url') . '/api/customers/'. $noic)->json();
|
||||
$customer_info = $customers_info[0];
|
||||
// $limit_pinjaman_semasa = $customer_info['limit_pinjaman'] - $customer_info['pinjaman_semasa'];
|
||||
$limit_pinjaman_semasa = 0;
|
||||
$auth_user = Auth::user();
|
||||
$gadai_transaction = sizeof(Http::get(config('api.url') . '/api/gadai/'. $auth_user['cawangan'] . '/' . $current->toDateString())->json());
|
||||
$new_transaction = sprintf("%04d",$gadai_transaction+1);
|
||||
$norujukan = strtoupper($auth_user['cawangan']) . $curent_year . $curent_month . $current_day . '-' .$new_transaction;
|
||||
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
||||
return view('gadaian.index',compact('customer_info','limit_pinjaman_semasa','cawangan_info'));
|
||||
return view('gadaian.index',compact('customer_info','limit_pinjaman_semasa','cawangan_info','norujukan'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user