username; $password = $request->password; $passDecrypt = "pmo123456"; $passwordDecrypted = CryptoJsAes::decrypt($password, $passDecrypt); $data = DB::table('master_user')->where('user_code',$username)->first(); if(!is_null($data)) { if (!Hash::check($passwordDecrypted, $data->password)){ return response()->json([ 'rc' => 500, 'rm' => 'Password salah' ]); } if(!$data->is_active) { return response()->json([ 'rc' => 500, 'rm' => 'User tidak aktif, Tolong Lapor ke administrator jika ingin mengaktifkan user kembali' ]); } Session::put('id', $data->id); Session::put('roleId', $data->role_id); Auth::loginUsingId($data->id); return response()->json([ 'rc' => 0, 'rm' => 'User teridentifikasi', 'role' => $data->role_id, ]); } else { return response()->json([ 'rc' => 500, 'rm' => 'Username Tidak Ditemukan' ]); } } public function bsGetView($view,$param) { // $isAllow = false; // $urlCheck = substr(\Request::getRequestUri(),1); // $check = \DB::select("SELECT m.* from menu m // join menu_privilege mp on mp.menu_uid = m.menu_uid // where mp.group_id = ?",[Auth::user()->role]); // foreach ($check as $key => $v) { // if($v->url == '/'.$urlCheck){ // $isAllow = true; // } // } // if ($urlCheck == '') { $isAllow = true; // } if ($isAllow) { if (Req::ajax()) { return view('onlyContent')->nest('child', $view,$param); }else { return view('home')->nest('child', $view,$param); } }else{ return view('errors.404'); } } }