Skip to content
This repository has been archived by the owner on Jun 18, 2019. It is now read-only.

Working with Eloquent's lists() Method #27

Closed
beratdogan opened this issue Jun 22, 2014 · 4 comments
Closed

Working with Eloquent's lists() Method #27

beratdogan opened this issue Jun 22, 2014 · 4 comments

Comments

@beratdogan
Copy link

Hey @dimsav, first thanks for this amazing package.

When I want to get translatable data with lists() I got "Fields couldn't find" errors. Code is here:

Category::lists('name', 'slug');

But I got data with this:

Category::all()->lists('name', 'slug');

But, this way couses a performance problem. First we get all lines, after select them. Is there any way to get data like first code?

@dimsav
Copy link
Owner

dimsav commented Jun 23, 2014

Hi @beratdogan,

to get a list of the category names you could use CategoryTranslation instead of Category.

For example:

CategoryTranslation::lists('name', 'slug');

or, for a specific locale:

CategoryTranslation::where('locale', '=', 'en')->lists('name', 'slug');

@beratdogan
Copy link
Author

I coun't because I have static slug not related to translations table.

This is a special condition I know. But I think this package needs to this addition.

@dimsav
Copy link
Owner

dimsav commented Aug 21, 2014

Sorry I couldn't find the time for this. Please send a pull request.

@dimsav dimsav closed this as completed Aug 21, 2014
@dimsav
Copy link
Owner

dimsav commented Jan 30, 2015

@beratdogan the scope is coming in the next update.

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

No branches or pull requests

2 participants