50 lines
1.9 KiB
PHP
50 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use App\Services\CustomerService;
|
|
use Illuminate\Support\Facades\Session;
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
class HomeController extends Controller
|
|
{
|
|
/**
|
|
* Create a new controller instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->middleware('auth');
|
|
}
|
|
|
|
/**
|
|
* Show the application dashboard.
|
|
*
|
|
* @return \Illuminate\Contracts\Support\Renderable
|
|
*/
|
|
public function index()
|
|
{
|
|
$auth_user = Auth::user();
|
|
if($auth_user['roles'] == 'teller'){
|
|
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
|
return view('homepage.'.$auth_user['roles'].'.home',compact('cawangan_info'));
|
|
}elseif($auth_user['roles'] == 'penilai'){
|
|
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
|
$gadaian_semasa = Http::get(config('api.url') . '/api/gadaiansemasa/'. $auth_user['cawangan'])->json();
|
|
$gadaian_belumserah = Http::get(config('api.url') . '/api/gadaiansemasa/belum_serah/'. $auth_user['cawangan'])->json();
|
|
return view('homepage.'.$auth_user['roles'].'.home',compact('cawangan_info','gadaian_semasa','gadaian_belumserah'));
|
|
}
|
|
elseif($auth_user['roles'] == 'khazanah'){
|
|
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
|
return view('homepage.'.$auth_user['roles'].'.home',compact('cawangan_info'));
|
|
}
|
|
elseif($auth_user['roles'] == 'operasi'){
|
|
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
|
return view('homepage.'.$auth_user['roles'].'.home',compact('cawangan_info'));
|
|
}
|
|
}
|
|
}
|