album = $album; $this->music = $music; } /** * Returns count of audio. * * @param array $filter * * @return int */ public function count() { return 0; } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.album.gadget', $count = 10) { if (User::hasRole('user')) { $this->album->pushCriteria(new \Litepie\Sneham\Repositories\Criteria\AlbumUserCriteria()); } $album = $this->album->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('audio::' . $view, compact('album'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.music.gadget', $count = 10) { if (User::hasRole('user')) { $this->music->pushCriteria(new \Litepie\Sneham\Repositories\Criteria\MusicUserCriteria()); } $music = $this->music->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('audio::' . $view, compact('music'))->render(); } }