Download the PHP package adelaide/laravel-fluent without Composer
On this page you can find all versions of the php package adelaide/laravel-fluent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download adelaide/laravel-fluent
More information about adelaide/laravel-fluent
Files in adelaide/laravel-fluent
Package laravel-fluent
Short Description Fork of based/laravel-fluent. Define model attributes the fluent way. Automatically cast properties to native types.
License MIT
Informations about the package laravel-fluent
Laravel Fluent
The package provides an expressive "fluent" way to define model attributes. It automatically builds casts at the runtime and adds a native autocompletion to the models' properties.
Introduction
With laravel-fluent
, you can define Model attributes as you would do with any other class. The values will be transformed to the corresponding types depending on the native types of the properties.
Before:
After:
Installation
This version supports PHP 8.0. You can install the package via composer:
Then, add the Based\Fluent\Fluent
trait to your models:
Model attributes
Define the public properties. laravel-fluent
supports all native types and Laravel primitive casts:
Fillable and guarded
Any property being managed by the library can be marked as fillable or guarded by annotating it with an attribute.
These attributes can also be specified at the class level, and they will affect multiple properties.
Relations
The package also handles relationships.
The package can automatically resolve relations from attributes, but be aware that there will be no autocompletion for the associated laravel-style methods.
Testing
Todo
- [ ] Migration generator
Credits
- Boris Lepikhin
- All Contributors
License
The MIT License (MIT). Please see License File for more information.