PHP code example of bramalho / laravel-utils

1. Go to this page and download the library: Download bramalho/laravel-utils library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bramalho / laravel-utils example snippets


BRamalho\LaravelUtils\LaravelUtilsServiceProvider::class,



namespace App\Repositories;

use App\User;
use BRamalho\LaravelUtils\Repository;

class UserRepository extends Repository
{
    public function __construct(User $model)
    {
        parent::__construct($model);
    }
}



namespace App;

use BRamalho\LaravelUtils\BasicEnum;

abstract class StatusEnum extends BasicEnum
{
    const ACTIVE = 1;
    const INACTIVE = 0;
}

StatusEnum::getConstants(); //["ACTIVE" => 1, "INACTIVE" => 0]
StatusEnum::isValidName('ACTIVE'); //true
StatusEnum::isValidName('WAITING'); //false
StatusEnum::isValidValue(1); //true
StatusEnum::isValidValue(2); //false
sh
php artisan vendor:publish --provider 'BRamalho\LaravelUtils\LaravelUtilsServiceProvider'