public function getIndex() { $mp3s = MP3::remember(120)->latest()->published()->take(3)->get(); $mp4s = MP4::remember(120)->latest()->take(3)->get(); $data = ['mp3s', 'mp4s']; return View::make('home', compact($data)); }
public function get_mp4() { $mp4 = MP4::remember(120)->latest()->paginate(30); $mp4_count = MP3::remember(120)->count(); $title = 'Administrayon Videyo (' . $mp4_count . ')'; return View::make('admin.mp4.index')->withTitle($title)->withMp4s($mp4)->withmp4Count($mp4_count); }
public function getBuy($id) { $key = '_mp3_buy_' . $id; if (Cache::has($key)) { $data = Cache::get($key); return View::make('mp3.buy', $data); } $mp3 = MP3::with('user', 'category')->published()->paid()->findOrFail($id); // $mp3->views += 1; // $mp3->save(); $data = []; $data['bought'] = ''; if (Auth::check()) { $user = Auth::user(); $data['bought'] = $user->bought()->whereMp3Id($mp3->id)->first(); } $data['related'] = MP3::remember(120)->related($mp3)->get(['id', 'name', 'image', 'play', 'download', 'views']); $data['author'] = $mp3->user->name . ' — '; $data['title'] = "Achte {$mp3->name}"; $data['mp3'] = $mp3; Cache::put($key, $data, 120); return View::make('mp3.buy', $data); }