Consider this array:
protected $filter = [
'preco' => 'required;double(1,4)',
'email' => 'required;email'
];
Step by foreach:
protected function bootFilterPost() {
foreach ($this->filter as $key => $value):
$this->postRules[$key] = preg_split('/(;)/', $value);
endforeach;
var_dump($this->postRules);
}
and I have this output:
array(2) {
["preco"]=>
array(2) {
[0]=>
string(8) "required"
[1]=>
string(11) "double(1,4)"
}
["email"]=>
array(2) {
[0]=>
string(8) "required"
[1]=>
string(5) "email"
}
}
But it would need to come out this way:
array(2) {
["preco"]=>
array(2) {
["required"]=>
string(8) "true"
["double"]=>
string(11) "1,4"
}
["email"]=>
array(2) {
["required"]=>
string(8) "true"
["email"]=>
string(5) "true"
}
}
that is, I need the values to be entered as braces, and the braces must be in string ("true") or boolean (true);