定制 sukohi/agnomen 二次开发

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

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

sukohi/agnomen

最新稳定版本:1.0.1

Composer 安装命令:

composer require sukohi/agnomen

包简介

A PHP package mainly developed for Laravel to set attributes for error messages of when failing validation.

README 文档

README

A PHP package mainly developed for Laravel to set attributes for error messages of when failing validation.

Installation

Add this package name in composer.json

"require": {
  "sukohi/agnomen": "1.*"
}

Execute composer command.

composer update

Usage

At first, add AgnomenTrait to App/Http/Requests/Request.php like this.

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Sukohi\Agnomen\AgnomenTrait;

abstract class Request extends FormRequest
{
    use AgnomenTrait;

    private $attribute_names = [
        'email' => 'YOUR-TEXT-1',
        'password' => 'YOUR-TEXT-2',
        'accepted' => 'YOUR-TEXT-3'
    ];

}

And make your own Request using the following command.

php artisan make:request *****Request
  • see here for the details

then add your validation rules there like this.

public function rules()
{
    return [
        'email' => 'required',
        'password' => 'required', 
        'accepted' => 'accepted'
    ];
}

Now if your application respond error messages, :attribute will be replaced with $attribute_names values.
See here for the details

e.g.)

The :attribute field is required. => The YOUR-TEXT-1 field is required.

License

This package is licensed under the MIT License.

Copyright 2015 Sukohi Kuhoh

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-08-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固