2017 © Pedro Peláez
 

library request

Extend Laravel 5's request class with support for custom validator rules.

image

mauri870/request

Extend Laravel 5's request class with support for custom validator rules.

  • Tuesday, February 27, 2018
  • by mauri870
  • Repository
  • 1 Watchers
  • 0 Stars
  • 452 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 58 % Grown

The README.md

Laravel 5 Extended Requests

Package that exteds the Laravel 5 FormRequest class to easily create custom validation rules., (*1)

Quick start

Required setup

In the require key of composer.json file add the following, (*2)

"mauri870/request": "dev-master"

Run the Composer update comand, (*3)

$ composer update

How to use

Make your request extends the Mauri870\Request\Request class., (*4)

use Mauri870\Request\Request;

class MyRequest extends Request {

Create your rules function with your custom rule:, (*5)

public function rules()
{
    return [
        'my-rule' => 'custom'
    ];
}

Create a function with the format validate<your_custom_rule>, like this:, (*6)

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., (*7)

public fucnction messages()
{
    return [
        'custom' => 'My custom message'
    ];
}

And that is it HAHA! :) Please enjoy!, (*8)

The Versions

27/02 2018

dev-master

9999999-dev

Extend Laravel 5's request class with support for custom validator rules.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lucas Padilha Gois

laravel request

27/02 2018

dev-hotfix/laravel-5.6

dev-hotfix/laravel-5.6

Extend Laravel 5's request.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lucas Padilha Gois

laravel request