/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(request $request)
 {
     DB::enableQueryLog();
     $imei = $request->input('imei');
     $api = $request->input('api');
     $client = ApiKeys::where('api', $api)->where('imei', $imei)->count();
     if ($client > 0) {
         $jsonArray = ["api" => true, "message" => ""];
     } else {
         $jsonArray = ["api" => false, "message" => "Client not registered."];
     }
     return response()->json($jsonArray);
 }
 function generateAPI()
 {
     $unique = false;
     $api = "";
     while (!$unique) {
         $api = str_random(20);
         $count = ApiKeys::where('api', '=', $api)->count();
         if ($count == 0) {
             $unique = true;
         }
     }
     return $api;
 }