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
<?php
namespace App;
use Artisanry\Collectable\Traits\HasCollections;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
use HasCollections;
}
$user->collection('favorites')->push($model);
$user->collection('favorites')->has($model);
$user->collection('favorites')->first();
$user->collection('favorites')->get($model);
$user->collection('favorites')->all();
$user->collection('favorites')->forget($model);
$user->collection('favorites')->flush();
$user->collection('favorites')->type(Post::class)->all();
$ phpunit
If you discover a security vulnerability within this package, please send an e-mail to hello@basecode.sh. 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).