首页 > 解决方案 > Laravel pluck with paginate

问题描述

So, I've a ERM with two database connected in a same laravel app. I'm trying to pull up all the IDs with pluck which is working fine but not being able to paginate. For an instance,

        $newsTagSaved = NewsTag::latest()->pluck('post_id');

This works just as fine. But this pulls up way more information than I need. I'm looking for something like:

->pluck('id')->paginate(12);  

This way I'm not loading data in ajax that I don't need since it will query unnecessary data on every ajax call.

Thank you!

标签: laravel

解决方案


推荐阅读