jessegall / laravel-non-null-collection-cast
Cast as a collection that is never null
v1.0.1
2023-08-23 19:15 UTC
Requires
- illuminate/database: ^9.21|^10.0
README
Simple cast for Laravel Eloquent models that allows you to cast a field to a non-null collection.
Installation
composer require jessegall/laravel-non-null-collection-cast
Usage
use Illuminate\Database\Eloquent\Model; use JesseGall\Laravel\Database\Casts\AsNonNullCollection; class MyModel extends Model { protected $casts = [ 'my_field' => AsNonNullCollection::class, ]; }