1. Go to this page and download the library: Download sfneal/validation-rulesets 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/ */
sfneal / validation-rulesets example snippets
namespace App\Rules\FieldRuleSets;
use Telkins\Validation\AbstractFieldRuleSet;
class EmailRuleSet extends AbstractFieldRuleSet
{
public function rules() : array
{
return [
// ...
];
}
}
public function rules() : array
{
return [
'email',
'max:255',
];
}
/**
* The validation rules that imply the field is 'Required', 'Filled', 'RequiredWith', 'RequiredWithAll', 'RequiredWithout',
'RequiredWithoutAll', 'RequiredIf', 'RequiredUnless', 'Accepted', 'Present',
];
namespace App\Rules\FieldRuleSets;
use Telkins\Validation\AbstractFieldRuleSet;
use Illuminate\Contracts\Validation\ImplicitRule;
class EmailRuleSet extends AbstractFieldRuleSet implements ImplicitRule
{
public function rules() : array
{
return [
'
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email_address' => ['
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email_address' => [new EmailAddressRuleSet()],
'subject' => '
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email_address' => [new EmailAddressRuleSet($this->all())],
'subject' => '
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email_address' => [(new EmailAddressRuleSet())->except('
namespace App\Rules\ResourceRuleSets;
use Telkins\Validation\AbstractResourceRuleSet;
class BlogPost extends AbstractResourceRuleSet
{
/**
* Provide rules that should be applied during creation and updating. If
* empty, then this method can be removed.
*
* @return array
*/
protected function provideRules() : array
{
return [
// ...
];
}
/**
* Provide rules that should be applied only during creation. If empty,
* then this method can be removed.
*
* @return array
*/
protected function provideCreationRules() : array
{
return [
// ...
];
}
/**
* Provide rules that should be applied only during updating. If empty,
* then this method can be removed.
*
* @return array
*/
protected function provideUpdateRules() : array
{
return [
// ...
];
}
}