Package Data | |
---|---|
Maintainer Username: | lukz |
Maintainer Contact: | lucaspgois@gmail.com (Lucas Padilha Gois) |
Package Create Date: | 2015-03-31 |
Package Last Update: | 2018-02-27 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-09-08 03:08:43 |
Package Statistics | |
---|---|
Total Downloads: | 5,595 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 3 |
Total Forks: | 1 |
Total Open Issues: | 1 |
Package that exteds the Laravel 5 FormRequest class to easily create custom validation rules.
In the require
key of composer.json
file add the following
"lukzgois/request": "dev-master"
Run the Composer update comand
$ composer update
Make your request extends the Lukzgois\Request\Request
class.
use Lukzgois\Request\Request;
class MyRequest extends Request {
Create your rules function with your custom rule:
public function rules()
{
return [
'my-rule' => 'custom'
];
}
Create a function with the format validate<your_custom_rule>
, like this:
public function validateCustom($attribute, $value, $params)
{
return $value == 'custom';
}
Do not forget to put a message for this new rule. It can be in the messages
function of the request or in the validation
of the lang files.
public fucnction messages()
{
return [
'custom' => 'My custom message'
];
}
And that is it HAHA! :) Please enjoy!