Skip to content

Instantly share code, notes, and snippets.

@ricardo-rossi
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricardo-rossi/0d4618424d5853415b4d to your computer and use it in GitHub Desktop.
Save ricardo-rossi/0d4618424d5853415b4d to your computer and use it in GitHub Desktop.
<?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