Last active
August 29, 2015 14:06
-
-
Save ricardo-rossi/0d4618424d5853415b4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Nutrient extends BaseModel { | |
protected $guarded = array(); | |
public static $rules = array( | |
'name' => 'required', | |
'unit' => 'required' | |
); | |
public static function with($relations) | |
{ | |
$b = parent::with($relations); | |
return parent::filterByAccount($b); | |
} | |
public function save(array $options = array()) | |
{ | |
parent::setAccount(); | |
parent::save($options); | |
} | |
public static function all($columns = array('*')) | |
{ | |
return parent::filterByAccount()->get(); | |
} | |
public static function find($id, $columns = array('*')) | |
{ | |
$b = parent::where('id', $id); | |
return parent::filterByAccount($b)->first(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment