Package Data | |
---|---|
Maintainer Username: | colbyr |
Maintainer Contact: | crabideau5691@gmail.com (Colby Rabideau) |
Package Create Date: | 2013-02-17 |
Package Last Update: | 2013-06-03 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:12:10 |
Package Statistics | |
---|---|
Total Downloads: | 360 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 27 |
Total Watchers: | 4 |
Total Forks: | 3 |
Total Open Issues: | 1 |
Self validating models for Eloquent in L4
{ // composer.json
...
"require": {
"laravel/framework": "4.0.*",
"awareness/aware": "dev-master"
},
...
}
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();