haegemon / lara-array
Lara-array provide postgresql array datatype support at Eloquent ORM.
Installs: 222
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/haegemon/lara-array
Requires
- php: >=5.4.0
- illuminate/support: >=5.0.0
This package is not auto-updated.
Last update: 2025-10-10 18:40:12 UTC
README
Lara-array provide postgresql array datatype support at Eloquent ORM. Inspired by darrylkuhn/dialect.
Installation
Require this package in your composer.json
file:
"haegemon/lara-array": "dev-master"
...then run composer update
to download the package to your vendor directory.
Usage
The feature is exposed through a trait rewrite standart casting attributes to change array parse from json_decode to special parser for postgresql array. For example we could create a Photos model like this:
use Eloquent\LaraArray\LaraArray as LaraArray; class Photo extends Eloquent { use LaraArray; protected $casts = [ 'marks' => 'array', ]; }
And then this:
$marks = $photo->marks; var_dump($marks); // array(2) { [0]=> string(1) "5" [1]=> string(1) "2" }