Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class BaseModel extends Eloquent {
- protected $year = null;
- public function setYear($year){
- $this->year = $year;
- if($year != null){
- $this->table = 'gamedata_'.$year.'_'.$this->getTable();
- }
- }
- public static function year($year){
- $instance = new static;
- $instance->setYear($year);
- return $instance->newQuery();
- }
- public function newInstance($attributes = array(), $exists = false)
- {
- $model = parent::newInstance($attributes, $exists);
- $model->setYear($this->year);
- return $model;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement