This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
This package is abandoned and no longer maintained. No replacement package was suggested.

Collectable Polymorphic Eloquent Models for Laravel 5

4.2.0 2019-08-28 13:01 UTC

This package is auto-updated.

Last update: 2020-01-28 14:33:04 UTC


Build Status PHP from Packagist Latest Version License


Require this package, with Composer, in the root directory of your project.

$ composer require artisanry/collectable

To get started, you'll need to publish the vendor assets and migrate:

php artisan vendor:publish --provider="Artisanry\Collectable\CollectableServiceProvider" && php artisan migrate


Setup a Model

namespace App;

use Artisanry\Collectable\Traits\HasCollections;
use Illuminate\Database\Eloquent\Model;

class User extends Model
    use HasCollections;
Add an item to the collection.
Determine if an item exists in the collection for a given model.
Get the first item from the collection.
Retrieve an item from the collection by model.
Get all of the items from the collection.
Remove an item from the collection.
Remove all items from the collection.
Set the item-type that should be filtered by.


$ phpunit


If you discover a security vulnerability within this package, please send an e-mail to All security vulnerabilities will be promptly addressed.


This project exists thanks to all the people who contribute.


Mozilla Public License Version 2.0 (MPL-2.0).