🥬 Desert Wishbone-bush
v2.4.2 - 🥬 Desert Wishbone-bush - 3rd February 2021
This version of Leaf continues the goal of making Leaf features more flexible and increasing usability.
Added
-
Added option to turn off experimental method warnings
-
Added
Form::rulewhich allows you to create your own rules for form validation.
Form::rule("max", function($field, $value, $params) {
if (strlen($value) > $params) {
Form::addError($field, "$field can't be more than $params characters");
return false;
}
});- Added internal
Leaf\Formfeature which allows you to pass parameters to validation rules.
$validation = Form::validate([
// To pass a param to a rule, just use :
"username" => "max:3",
]);- Added
Form::addErrorwhich allows you to add errors to be returned inForm::errors()
Form::addError($field, "$field can't be more than $params characters");- Added max and min rules by default
$validation = Form::validate([
"username" => "max:1",
"password" => "min:81",
]);- Guards can be used even in API mode. This will alert you if you're not eligible to view a particular page.
Fixed
-
Updated dependencies with security patches
-
Fixed multiple validation breaks from v2.4.2 beta.
Changed
- Made
Leaf\Formmethods static. They can now be called from anywhere within your Leaf app.
Removed
- No removals