Ejemplo n.º 1
0
 public function getAlbumById($id)
 {
     try {
         $album = AmaotoAlbum::whereId($id)->first();
         if (!$album) {
             throw new NotExistException('此专辑不存在');
         }
         return Response::json(array('type' => 'success', 'message' => '获取成功', 'data' => $album->toDataArray()));
     } catch (NotExistException $e) {
         return Response::json(array('type' => 'warning', 'message' => $e->getMessage()));
     } catch (Exception $e) {
         return Response::json(array('type' => 'error', 'message' => $e->getMessage()));
     }
 }