定制 lukzgois/request 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lukzgois/request

Composer 安装命令:

composer require lukzgois/request

包简介

Extend Laravel 5's request.

README 文档

README

Package that exteds the Laravel 5 FormRequest class to easily create custom validation rules.

Quick start

Required setup

In the require key of composer.json file add the following

"lukzgois/request": "dev-master"

Run the Composer update comand

$ composer update

How to use

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!

统计信息

  • 总下载量: 5.63k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-31