apollopy/laravel-x-eloquent
laravel-x-eloquent
Installation
composer require apollopy/laravel-x-eloquent
After updating composer, add the service provider to the providers array in config/app.php
ApolloPY\Eloquent\EloquentServiceProvider::class,
Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
Extension
sortByIds
$ids = [3, 1, 2];
$posts = Post::find($ids); // collection -> [1, 2, 3]
$posts = $posts->sortByIds($ids); // collection -> [2 => 3, 0 => 1, 1 => 2]
$posts = $posts->values(); // collection -> [3, 1, 2]
chunkByTime
Topic::where('user_id', 1)->chunkByTime(3600, function ($topics) {
//
});
Related Packages
martinbean/laravel-sluggable-trait
A trait you can apply to Eloquent models to have slugs automatically generated o...
49,105
24
isswp101/elasticsearch-eloquent
Elasticsearch functionality like Laravel Eloquent models.
25,142
112
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 2.0.0 | >=5.6.4 | ^5.4 | MIT | |
| 1.2.0 | >=5.5.9 | 5.1.*| | MIT | |
| 1.1.2 | >=5.5.9 | 5.1.*| | MIT | |
| 1.1.1 | >=5.5.9 | 5.1.* | MIT | |
| 1.1.0 | >=5.5.9 | 5.1.* | MIT | |
| 1.0.0 | >=5.5.9 | 5.1.* | MIT |