public function details($id) { $user = \App\User::find($id); $apps = \App\Aplication::all()->where('user_id', $id + 0); //$apps =array(); return view('user_details')->with(['user' => $user, 'apps' => $apps]); }
public function destroy($id) { $app = \App\Aplication::findOrFail($id); DB::table('clients_app')->where('aplication_id', $id)->delete(); $app->delete(); return redirect()->route('apps'); }
public function closeOTP(Request $request, $code, $ip) { $key = $request->headers->get('pub-key'); $app = \App\Aplication::where('public_key', $key)->get(); if (isset($app[0])) { $encrypt = crypt($code, $app[0]->private_key); $otp = \App\Otp::where('code', $encrypt)->get(); if (isset($otp[0])) { if ($otp[0]->status == 'U' and $otp[0]->ip == $ip) { $otp[0]->status = 'N'; $otp[0]->save(); return array('response' => true); } else { return array('response' => false); } } else { return array('response' => false); } } else { return response()->json(['response' => 'no autorizado'], 401); } }