bagsiz / easy-functions
There is no license information available for the latest version (v1.1.2) of this package.
Laravel package for useful & easy PHP functions
v1.1.2
2019-09-09 10:34 UTC
Requires
- php: ^7.2
- illuminate/database: ~5.8.0
- laravel/framework: ^5.4.0
Requires (Dev)
- orchestra/testbench: ~3.8.0
- phpunit/phpunit: ^7.5|^8.0
This package is auto-updated.
Last update: 2024-10-29 05:52:54 UTC
README
Laravel package for useful & easy functions
Installation
This package can be installed through Composer.
composer require bagsiz/easy-functions
Functions
checkFieldForRandom
This function aims to check a model's fields against a random value and return that value
Usage
For example we want to check the id
fields of App\User
model,
you should write;
function checkUserModel() { $user = new User(); $return EasyFunction::checkFieldForRandom($user, 'id', 'int', 8); }
checkFieldForRandom($model, string $field, string $type, int $length)
- $model = The collection of the model
- $fiels = The field of the model -> String
'field'
- $type = The type of value you want to generate -> String
'str'
or Integer'int'
. Default'str'
- $length = The length of value you want to generate -> Int
8
. Default8
decimalToTime
This function aims to convert an integer with a decimal to time string
Usage
function someFunction() { $timeString = EasyFunction::decimalToTime(936437.85); // Should return "10:20:07:17.85" }
decimalToTime(int $decimal)
- $decimal = Must have a "." for decimal part. (Ex: 23.56)
Testing
./vendor/bin/phpunit