public function showListMusicPage()
 {
     if (!$this->CurrentUser || !$this->CurrentUser->isAdmin()) {
         return Redirect::to('login');
     }
     $Musics = AmaotoMusic::orderBy('id', 'desc')->paginate(15);
     return View::make('admin/list-music', array('Musics' => $Musics));
 }
 public function showMusicPage()
 {
     if (!Config::get('constants.installed')) {
         return Redirect::to('install');
     }
     $musics = AmaotoMusic::orderBy('id', 'desc')->paginate(28);
     return View::make('home/music-page', array('musics' => $musics));
 }
 public function getMusicsByOffsetAndLimit($offset = 0, $limit = 10)
 {
     try {
         if (!is_numeric($offset)) {
             $offset = 0;
         }
         if (!is_numeric($limit)) {
             $limit = 10;
         }
         $musics = AmaotoMusic::orderBy('id', 'desc')->offset($offset)->limit($limit)->get();
         $array = array();
         foreach ($musics as $music) {
             /** @var AmaotoMusic $music */
             $array[] = $music->toDataArray();
         }
         return Response::json(array('type' => 'success', 'message' => '获取成功', 'data' => $array));
     } catch (NotExistException $e) {
         return Response::json(array('type' => 'warning', 'message' => $e->getMessage()));
     } catch (Exception $e) {
         return Response::json(array('type' => 'error', 'message' => $e->getMessage()));
     }
 }