Exemplo n.º 1
0
 /**
  * @api            {get} /users/{username}/albums Get User's Images
  * @apiGroup       Users
  * @apiDescription Gets albums created by a user. The results are paginated with 15 results per page.
  * @apiParam {string} [sessionKey] A session key belonging to this user. Unless this is given anonymous
  *     and passworded albums will be omitted.
  * @apiParam {int} [page=1] Results page number.
  * @apiUse         PaginatedAlbumResponse
  *
  * @param User $user
  *
  * @return Response
  */
 public function indexAlbums(User $user)
 {
     $this->validate($this->request, ['page' => 'int|min:1']);
     $results = $user->albums();
     // TODO
     /*if (!$this->isCurrentUser($user)) {
           $results->where('anonymous', 0)->whereNull('password');
       }*/
     $results->orderBy('title', 'ASC');
     $paginator = $results->paginate($this->getResultsPerPage());
     return $this->response($this->paginatorToArray($paginator, 'albums'));
 }