PHPackages                             jn-jairo/laravel-eloquent-cast - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. jn-jairo/laravel-eloquent-cast

ActiveLibrary[Database &amp; ORM](/categories/database)

jn-jairo/laravel-eloquent-cast
==============================

Cast for Laravel Eloquent.

v3.0.2(1y ago)021MITPHPPHP ^8.1

Since Feb 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/jn-jairo/laravel-eloquent-cast)[ Packagist](https://packagist.org/packages/jn-jairo/laravel-eloquent-cast)[ Docs](https://github.com/jn-jairo/laravel-eloquent-cast)[ RSS](/packages/jn-jairo-laravel-eloquent-cast/feed)WikiDiscussions 3.x Synced 4d ago

READMEChangelog (10)Dependencies (5)Versions (19)Used By (0)

[![Total Downloads](https://camo.githubusercontent.com/28924c7932e9678093b7290544445f20d582a25d89aff1b3cd11e076f63e6942/68747470733a2f2f706f7365722e707567782e6f72672f6a6e2d6a6169726f2f6c61726176656c2d656c6f7175656e742d636173742f646f776e6c6f616473)](https://packagist.org/packages/jn-jairo/laravel-eloquent-cast)[![Latest Stable Version](https://camo.githubusercontent.com/8e333fefa7db47fb4c5045fcce529697b738fac6e083dce131da1e39968b3f90/68747470733a2f2f706f7365722e707567782e6f72672f6a6e2d6a6169726f2f6c61726176656c2d656c6f7175656e742d636173742f762f737461626c65)](https://packagist.org/packages/jn-jairo/laravel-eloquent-cast)[![License](https://camo.githubusercontent.com/832b3ac43bc52191ce2e1f3853b71b4d30c048ad79e502052b199542e7901237/68747470733a2f2f706f7365722e707567782e6f72672f6a6e2d6a6169726f2f6c61726176656c2d656c6f7175656e742d636173742f6c6963656e7365)](https://packagist.org/packages/jn-jairo/laravel-eloquent-cast)

Cast for Laravel Eloquent
=========================

[](#cast-for-laravel-eloquent)

This package extends the built-in [attribute casting](https://laravel.com/docs/eloquent-mutators#attribute-casting)with the [jn-jairo/laravel-cast](https://github.com/jn-jairo/laravel-cast) package.

Version Compatibility
---------------------

[](#version-compatibility)

LaravelEloquent Cast5.8.x1.x6.x1.x7.x2.x8.x3.x9.x3.x10.x3.x11.x3.x12.x3.xInstallation
------------

[](#installation)

You can install the package via composer:

```
composer require jn-jairo/laravel-eloquent-cast
```

Usage
-----

[](#usage)

Use the trait `\JnJairo\Laravel\EloquentCast\HasAttributesCast` in a `\Illuminate\Database\Eloquent\Model`. In the `$casts` property of the model set the attribute name as the key and the type:format as the value.

```
