PHP code example of russoedu / colorvalidator
1. Go to this page and download the library: Download russoedu/colorvalidator 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/ */
russoedu / colorvalidator example snippets
php
'providers' = [
Russoedu\ColorValidator\ColorValidatorServiceProvider::class,
]
php
public function store(Request $request) {
$this->validate($request, [
'color' => 'hex_color'
]);
}
php
$validator = Validator::make($request->all(), [
'color' => 'hex_color'
], [
'color.hex_color' => "Hey! That's not real color!"
]);
if($validator->fails()) {
return $this->returnWithErrorAndInput($validator);
}