easoblue/larahelper

Laravel helpers.

1.0.1 2022-11-28 11:11 UTC

This package is auto-updated.

Last update: 2024-08-28 15:04:32 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

Installation

You can install the package via composer:

composer require easoblue/larahelper

Usage

You can add alias for shorthand or import LaraHelper facade directly.

use Easoblue\LaraHelper\Facade\LaraHelper;

Once ready you can use generateString method to generate random or unique string. You can pass paramter to generate specific type of string.

LaraHelper::generateString('alpha');

You can use checkUnique and chain with generateString, table name and column name will be required to validate the unique string.

LaraHelper::checkUnique('users','username')->generateString('alpha');
LaraHelper::checkUnique('users','username')->generateString('alpha');

LaraHelper::checkUnique('users','username')->prefix('u_')->postfix('u_')->generateString('alpha');
// prefix will be prepended to the generated string before checking unique.
Same as postfix will be appended to the generated string before checking unique.


// This method will format the error response and return the object with single validation error instead of array.

// $validator is the intance of Illuminate\Validation\Validator class;
if($validator->fails()){
 return LaraHelper::formatValidatorError($validator);
}

LaraHelper::formatToCamelCase('format to camel case');

Testing

to be added.

Complete documentation

Complete documentation will be available at doc.easoblue.com

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email issues@easoblue.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.