churakovmike / laravel-form-typecast
Laravel request form type casting
dev-master
2020-04-12 16:52 UTC
Requires
- illuminate/console: ^5.5|^6|^7
- illuminate/contracts: ^5.5|^6|^7
- illuminate/database: ^5.5|^6|^7
- illuminate/http: ^5.5|^6|^7
- illuminate/pagination: ^5.5|^6|^7
- illuminate/support: ^5.5|^6|^7
- illuminate/view: ^5.5|^6|^7
Requires (Dev)
- orchestra/testbench: >=3.0
- phpunit/php-code-coverage: ^6.1.4|>=7
- phpunit/phpunit: ^7.5|>=8.3
This package is auto-updated.
Last update: 2024-11-13 03:35:24 UTC
README
Requirements
- laravel 5.5+
Getting started
Install
The package is available on packagist.
composer require churakovmike/laravel-form-typecast
Usage
You just need to use this trait.
<?php namespace App\Http\Requests; use ChurakovMike\FormTypeCast\TypeCastTrait; use Illuminate\Foundation\Http\FormRequest; class ExampleFormRequest extends FormRequest { use TypeCastTrait; /** * @var array */ protected $casts = [ 'name' => 'string', 'age' => 'int', 'salary' => 'float', ]; }
This trait is a wrapper over HasAttributes.php trait.