for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Rinvex\Support\Traits;
use Watson\Validating\Injectors\UniqueWithInjector;
use Watson\Validating\ValidatingTrait as BaseValidatingTrait;
trait ValidatingTrait
{
use UniqueWithInjector;
use BaseValidatingTrait;
/**
* Merge new validation rules with existing validation rules on the model.
*
* @param array $rules
* @return $this
*/
public function mergeRules(array $rules)
$this->rules = array_merge($this->rules, $rules);
rules
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
return $this;
}
* Register a validating event with the dispatcher.
* @param \Closure|string $callback
* @return void
public static function validating($callback)
static::registerModelEvent('validating', $callback);
* Register a validated event with the dispatcher.
public static function validated($callback)
static::registerModelEvent('validated', $callback);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: