private function searchMP3($query) { $mp3results = MP3::published()->search($query)->orderBy('play', 'desc')->orderBy('download', 'desc')->take(20)->get(['id', 'name', 'play', 'download', 'image', 'price']); $mp3results->each(function ($mp3) { $mp3->icon = 'music'; $mp3->type = 'mp3'; }); return $mp3results; }
private function getRSS($type) { $key = $type . '_rss_feed_'; if (Cache::has($key)) { return Cache::get($key); } if ($type == 'mp3') { $objs = MP3::published()->latest()->take(10)->get(); $hash = 'Mizik'; } elseif ($type == 'mp4') { $objs = MP4::latest()->take(10)->get(); $hash = 'Videyo'; } $rss = $this->buildRssData($objs, $type, $hash); $rss = Response::make($rss)->header('Content-type', 'application/rss+xml'); Cache::put($key, $rss, 30); return $rss; }
public function getPlayMP3($id) { $mp3 = MP3::published()->whereId($id)->first(); if ($mp3->price == 'paid') { return Redirect::to("/mp3/buy/{$mp3->id}")->withMessage(Config::get('site.message.cant-play')); } TKPM::stream($mp3); }