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'); }
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')); }
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; }
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')); }
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.']); }
/** * 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'); }
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')); }
/** * 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'); }