public function downloadApp($id)
 {
     $downloads = Download::findOrNew($id);
     $downloads->count = $downloads->count + 1;
     $downloads->save();
     return \Redirect::to($downloads->link);
 }
 /**
  * Delete downloadable file from path and DB
  *
  * @param $id
  * @return mixed
  */
 public function deleteFile($id)
 {
     $file = Download::find($id);
     File::delete($file->filename);
     $file->delete();
     return redirect()->back()->with('flash_message', $file->filename . ' deleted');
 }
Ejemplo n.º 3
0
 public function index()
 {
     $blogs = Blog::with('user')->orderBy('created_at', 'desc')->paginate(15);
     $downloads = Download::with('user')->orderBy('created_at', 'desc')->paginate(15);
     $samples = Sample::with('user')->orderBy('created_at', 'desc')->paginate(15);
     $lastusers = User::orderBy('created_at', 'desc')->paginate(15);
     $sample_cats = Samplecategories::all();
     $guests = Online::guests()->count();
     return view('index', compact('blogs', 'downloads', 'samples', 'sample_cats', 'lastusers', 'guests'));
 }
Ejemplo n.º 4
0
 public function uploadFile($file, $id)
 {
     $download = Download::find($id);
     if (!$download) {
         $download = Download::create(['slug' => str_random(10), 'is_temporary' => true]);
     }
     $id = $download->id;
     $filename = $file->getClientOriginalName();
     $extension = MediaHelp::getExtension($filename);
     $download->file = $filename;
     $download->save();
     $download_path = 'web/download';
     if (!Storage::disk('public')->exists($download_path)) {
         Storage::disk('public')->makeDirectory($download_path);
     }
     $path = $download_path . '/' . $id;
     if (Storage::disk('public')->exists($path)) {
         Storage::disk('public')->deleteDirectory($path);
     }
     Storage::disk('public')->makeDirectory($path);
     $file->move($path, $filename);
     return $download;
 }
Ejemplo n.º 5
0
 public function users(User $user)
 {
     $downloads = Download::where('user_id', $user->id)->where('del', 0)->paginate(config('app.paginat_min'));
     return view('user.blogs', compact('downloads', 'user'));
 }
Ejemplo n.º 6
0
 public function fundFileDelete(Request $request, $downloadid)
 {
     $id = $request->input('id', 0);
     $result = null;
     $download = Download::find($downloadid);
     if ($download) {
         // Remove old file from directory
         if (file_exists($download->file_path)) {
             $result = unlink($download->file_path);
             $download->delete();
         }
     }
     if ($result) {
         return response()->json(['id' => $downloadid]);
     }
     return response()->json(['error' => 'Error, can not remove file.']);
 }
Ejemplo n.º 7
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Download $download)
 {
     $id = $download->game_id;
     $download->deleteDownloadFile();
     $download->delete();
     Session::flash('message', 'Download deleted');
     return redirect('/game/' . $id . '/download');
 }
Ejemplo n.º 8
0
 public function product()
 {
     $data = array('brand' => Brand::all(), 'barang' => Product::paginate(15), 'cart' => Cart::content(), 'total' => Cart::total(), 'download' => Download::limit(3)->offset(0)->get(), 'testimoni' => Testimoni::limit(10)->offset(0)->get());
     return view('front.product', compact('data'));
 }
 /**
  * Show the file download page
  *
  * @return Response
  */
 public function index()
 {
     $downloads = Download::all();
     return view('downloads.index', compact('downloads'));
 }
Ejemplo n.º 10
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Download::find($id)->delete();
     \Flash::success('File Download Berhasil Dihapus');
     return redirect('admin/download');
 }