public function betacheck(Request $request)
 {
     $pkgname = $request->input('pkgname', 'www.chasetch.com');
     $version = $request->input('version', 0);
     $filemd5 = $request->input('md5', 0);
     $deviceid = $request->id;
     $apk = TestApk::where('pkgname', $pkgname)->first();
     if (!empty($apk)) {
         if ($apk->version > $version) {
             echo "have update\n";
             echo action('Api\\UpdateapkController@betadownload', array('token' => $apk->token, 'filename' => $apk->filename)) . "\n";
         } else {
             echo "no update available\n";
         }
     } else {
         echo "apk not found\n";
     }
 }
Ejemplo n.º 2
0
 public function betadownload(Request $request, $token, $filename)
 {
     $apk = TestApk::where('token', $token)->where('filename', $filename)->first();
     if (!empty($apk)) {
         $pathToFile = storage_path() . "/beta_apk/" . $apk->pkgname . "/" . $apk->filename;
         $apk->downloads = $apk->downloads + 1;
         $apk->update();
         $file = $pathToFile;
         //not public folder
         if (file_exists($file)) {
             header('Content-Description: File Transfer');
             header('Content-Type: application/vnd.android.package-archive');
             header('Content-Disposition: attachment; filename=' . basename($file));
             header('Content-Transfer-Encoding: binary');
             header('Expires: 0');
             header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
             header('Pragma: public');
             header('Content-Length: ' . filesize($file));
             readfile($file);
             exit;
         }
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $apk = TestApk::findOrFail($id);
     $path = base_path() . '/storage/beta_apk/' . $apk->pkgname;
     \File::deleteDirectory($path);
     $apk->delete();
     Session::flash('flash_class', 'alert-success');
     Session::flash('flash_message', 'Beta Apk successfully deleted.');
     return redirect()->route("testapk.index");
 }