Package Data | |
---|---|
Maintainer Username: | Sukohi |
Maintainer Contact: | capilano.sukohi@gmail.com (Sukohi) |
Package Create Date: | 2015-08-20 |
Package Last Update: | 2015-08-20 |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2024-11-22 03:11:15 |
Package Statistics | |
---|---|
Total Downloads: | 23 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
A PHP package mainly developed for Laravel to set attributes for error messages of when failing validation.
Add this package name in composer.json
"require": {
"sukohi/agnomen": "1.*"
}
Execute composer command.
composer update
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
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.
This package is licensed under the MIT License.
Copyright 2015 Sukohi Kuhoh