PHP code example of grupo-cometa / request-validation

1. Go to this page and download the library: Download grupo-cometa/request-validation 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/ */

    

grupo-cometa / request-validation example snippets




namespace App\Console;
use GrupoCometa\Validations\Commands\GeneratorValidation;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
  
    protected $commands = [
        GeneratorValidation::class
    ];

}



use App\Http\Middleware\Validations\Robot\UserStoreValidation;
use App\Http\Middleware\Validations\Robot\UserUpdateValidation;

$router->post('/', [
    'uses' => 'UserController@store',
    'middleware' => [UserStoreValidation::class]
]);

$router->put('/', [
    'uses' => 'UserController@update',
    'middleware' => [UserUpdateValidation::class]
]);

bash
php artisan validations:generator {model}
bash
php artisan validations:generator App\\Models\\Users