awareness / aware
Model validation for L4 Eloquent
dev-master
2013-06-03 17:06 UTC
Requires
- php: >=5.3.0
- illuminate/support: 4.0.x
This package is not auto-updated.
Last update: 2024-11-23 14:59:00 UTC
README
Self validating models for Eloquent in L4
Installation
Composer
{ // composer.json
...
"require": {
"laravel/framework": "4.0.*",
"awareness/aware": "dev-master"
},
...
}
Usage
Create a model with validation rules:
<?php use Awareness\Aware\Model; class User extends Model { public static $rules = array( 'name' => 'required' ); }
Try to save it:
$user = new User(); $user->save(); // returns false $user->name = 'Colby'; $user->save(); // saves then returns true!
Save without validating:
$user = new User(); $user->force()->save();