list gadai detail

This commit is contained in:
Zakwan Hamdan
2020-10-26 13:38:29 +08:00
parent 4a83c0439e
commit 29b6272c5f
18 changed files with 103 additions and 100995 deletions
@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
class LoginController extends Controller
{
@@ -57,7 +58,9 @@ class LoginController extends Controller
$credentials = $request->only('email', 'password');
if (Auth::attempt($credentials)) {
return view('homepage.home');
$auth_user = Auth::user();
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
return view('homepage.home',compact('cawangan_info'));
}
return redirect('login')->with('error', 'Oppes! You have entered invalid credentials');
+10 -3
View File
@@ -44,12 +44,19 @@ class CustomersController extends Controller
$auth_user = Auth::user();
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
$customer_info = Http::get(config('api.url') . '/api/customers/'. $noic)->json();
// dd($customer_info);
$customers_info = Http::get(config('api.url') . '/api/customers/'. $noic)->json();
$customer_info = $customers_info[0];
$belum_tebus = Http::get(config('api.url') . '/api/customers/'. $noic .'/gadai/belum_tebus')->json();
$sudah_tebus = Http::get(config('api.url') . '/api/customers/'. $noic .'/gadai/sudah_tebus')->json();
$lelong = Http::get(config('api.url') . '/api/customers/'. $noic .'/gadai/lelong')->json();
// dd($belum_tebus);
$search = true;
if($customer_info){
Session::put('customer_info',$customer_info);
return redirect()->route('customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info] );
Session::put('belum_tebus',$belum_tebus);
return redirect()->route('customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info,'belum_tebus'=>$belum_tebus,'sudah_tebus'=>$sudah_tebus,'lelong'=>$lelong]);
}else{
return view('customers.index',compact('customer_info','search','noic','cawangan_info'));
}