Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get first 6 items in controller? #25

Closed
qyqyqy03 opened this issue Aug 13, 2016 · 8 comments
Closed

How to get first 6 items in controller? #25

qyqyqy03 opened this issue Aug 13, 2016 · 8 comments

Comments

@qyqyqy03
Copy link

In my Controller
I use
$items = Item::all();

to get all items

but I want to get only the first 6 items, but i cant use
$items = Item::take(6)->get();

@baopham
Copy link
Owner

baopham commented Aug 15, 2016

This is not supported yet. It will need to rely on the Range key to have an ordered result and then we set the limit to 6.

@qyqyqy03
Copy link
Author

How to set the limit? Where is Range key?

@baopham
Copy link
Owner

baopham commented Aug 17, 2016

you'll need to always check the README. If the methods are not there then they are not supported

@baopham baopham closed this as completed Aug 17, 2016
@qyqyqy03
Copy link
Author

qyqyqy03 commented Aug 18, 2016

If I get All the rows from dynamodb, it will be very slow
Everytime I run all(), it spends about 5-6s
and I have only about 20 rows

@baopham
Copy link
Owner

baopham commented Oct 8, 2016

@qyqyqy03 do you think using chunk would help? it's no guarantee that they will be the first 6 items though - I think the order will not always be the same.

Sorry I missed the comment.

@baopham baopham reopened this Oct 8, 2016
@baopham
Copy link
Owner

baopham commented Nov 24, 2016

Closing due to inactivity.

@baopham baopham closed this as completed Nov 24, 2016
@muneeb-arif
Copy link

why issue is closed? no one proposed the solution.... i'm new to dynamodb and reading its documentation regarding Query & Scan ... but its not helping... how can we apply these within laravel ?

@baopham
Copy link
Owner

baopham commented Feb 9, 2017

Closing due to inactivity.

I suggested to use chunk if it would help, depending on your use case. In short, this is not implemented yet:

User::take(6)->get()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants