Download the PHP package teepluss/harvey without Composer
On this page you can find all versions of the php package teepluss/harvey. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download teepluss/harvey
More information about teepluss/harvey
Files in teepluss/harvey
Download teepluss/harvey
More information about teepluss/harvey
Files in teepluss/harvey
Vendor teepluss
Package harvey
Short Description Laravel4 separate validation
License MIT
Homepage https://github.com/teepluss/laravel4-harvey
Package harvey
Short Description Laravel4 separate validation
License MIT
Homepage https://github.com/teepluss/laravel4-harvey
Please rate this library. Is it a good library?
Informations about the package harvey
Harvey is separate validation for Laravel 4
This is my internal project, not yet complete.
Installation
To get the lastest version of Theme simply require it in your composer.json
file.
"teepluss/harvey": "dev-master"
You'll then need to run composer install
to download it and have the autoloader updated.
Usage
class Blog extends \Teepluss\Harvey\Harvey {
/**
* Define rules.
*
* @type array
*/
public static $rules = array(
'description' => 'min:10|max:500',
'onCreate' => array(
'title' => 'required',
'url' => 'active_url'
),
'onUpdate' => array(
'title' => 'required'
)
);
/**
* Custom validation messages.
*
* @type array
*/
public static $messages = array(
'title.required' => 'Please fill title before submitting.'
);
/**
* Custom validation labels.
* @type array
*/
public static $lables = array(
'title' => 'Title'
);
/**
* Construct.
* @param array $attributes
* @return void
*/
public function __construct(array $attributes = array())
{
parent::__construct($attributes);
// Custom label.
$this->setLabelNames(array(
'title' => trans('labels.product'),
));
}
/**
* Event before validate.
*
* @return voide
*/
protected function beforeValidate()
{
$validator->sometimes('description', 'numeric', function($input)
{
return $input->title == 'tee';
});
}
}
This code for creating a new content.
$blog = new Blog;
$blog->title = 'New blog';
$blog->description = 'This is my first entry';
$blog->url = 'http://www.domain.com';
// Addition rule for another input.
$blog->addValidate(
array('other' => Input::get('other')),
array('other' => 'required|email'),
array('other.required' => 'sss')
);
if ( ! $blog->save())
{
$errors = $blog->errors();
return Redirect::back()->withErrors($errors)->withInput();
}
Validation rules for creating.
array(3) [
'description' => array(2) [
string (6) "min:10"
string (7) "max:500"
]
'title' => array(1) [
string (8) "required"
]
'url' => array(1) [
string (10) "active_url"
]
]
This code for updating an exists content.
$blog = Blog::find(1);
$blog->title = 'New blog';
$blog->description = 'This is my first entry';
$blog->url = 'http://www.domain.com';
$blog->save();
if ( ! $blog->save())
{
$errors = $blog->errors();
return Redirect::back()->withErrors($errors)->withInput();
}
Validation rules for updating.
array(2) [
'description' => array(2) [
string (6) "min:10"
string (7) "max:500"
]
'title' => array(1) [
string (8) "required"
]
]
Support or Contact
If you have some problem, Contact [email protected]
All versions of harvey with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.3.0
The package teepluss/harvey contains the following files
Loading the files please wait ....