I'm creating a custom validation customVal on the input field username. I'm sending other input as a parameter, but the value of the parameter is being received as null.
In my controller I have:
$this->validate(request(),[
'username' => 'customVal: firstname',
]);
And on app\Providers\AppServiceProviders I'm dumping the first parameter as a test:
public function boot()
{
\Validator::extend('customVal', function ($attribute, $value, $parameters, $validator)
{
dd( Request::get($parameters[0]) ."-". request($parameters[0]) ."-". Input::get($parameters[0]) ."-". $parameters[0] );
return true;
});
}
which shows
"--- firstname"
...the value is null, however I can get it's name (firstname). And just to make sure, when I dump this on the controller:
dd( $request->get('firstname') ."-". request('firstname') ."-". Input::get('firstname') ."-". 'firstname' );
I get:
"myname-myname-myname-firstname"
So that's basically it, I can't work on the custom validation because I can't get any values.
And I'm guessing the same happens when I try to use the require_without_all validation. Because it doesn't recognize it's parameters (what I write on the fields)
:andfirstnamein your validation array.