I have a form validation class:
class EditItemsForm extends Laracasts\Validation\FormValidator
{
protected $rules = [
'name' => 'required|alpha'
];
}
I need to use the value in $rulesto fill Former::withRules()so that it can do this.
I could try adding a static method getRulesso that I can do Former::withRules(EditItemsForm::getRules())it to get a protected value, but for this I need to create a new instance EditItemsFormfor which the parent FromValidatoris required Laracasts\Validation\FactoryInterfaceas the first argument to the constructor.
Example:
public static function getRules()
{
return with(new self(null))->rules;
}
Call me spoiled, but I never had to deal with this before. Thus, Laravel is used to magically inject dependencies in the background when input values are passed to the controller.
$rules FactoryInterface, , getRules?