Download the PHP package hnhdigital-os/laravel-model-schema without Composer
On this page you can find all versions of the php package hnhdigital-os/laravel-model-schema. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hnhdigital-os/laravel-model-schema
More information about hnhdigital-os/laravel-model-schema
Files in hnhdigital-os/laravel-model-schema
Package laravel-model-schema
Short Description Changes how the Eloquent Model provides attributes.
License MIT
Informations about the package laravel-model-schema
Combines the casts, fillable, and hidden properties into a single schema array property amongst other features.
Other features include:
- Custom configuration entries against your model attributes.
- Store your attribute rules against your model and store and validate your model data automatically.
- Custom casting is now possible using this package! See Custom casts.
This package has been developed by H&H|Digital, an Australian botique developer. Visit us at hnh.digital.
Documentation
- Prerequisites
- Installation
- Configuration
- Custom casts
- Contributing
- Reporting issues
- Credits
- License
Prerequisites
- PHP >= 8.0.2
- Laravel >= 9.0
Installation
Via composer:
$ composer require hnhdigital-os/laravel-model-schema ~3.0
Configuration
Enable the model
Enable the model on any given model.
We recommend implementing a shared base model that you extend.
Convert your current properties
The schema for a model is implemented using a protected property.
Here's an example:
Ensure the parent boot occurs after your triggers so that any attribute changes are done before this packages triggers the validation.
Models implementing this package will now throw a ValidationException exception if they do not pass validation. Be sure to catch these.
Custom casts
This package allows the ability to add custom casts. Simply create a trait, and register the cast on boot.
Defining your attributes would look like this:
Casting parameters would include a helper function, or a local model method.
eg $currency:user_locale()
, or $currency():$locale()
Available custom casts
- Cast the attribute to Money
Contributing
Please review the Contribution Guidelines.
Only PRs that meet all criterium will be accepted.
Reporting issues
When reporting issues, please fill out the included template as completely as possible. Incomplete issues may be ignored or closed if there is not enough information included to be actionable.
Code of conduct
Please observe and respect all aspects of the included Code of Conduct.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-model-schema with dependencies
laravel/framework Version ^9.21|^10.0
hnhdigital-os/laravel-null-carbon Version ~3.0