get('param'); if(! empty($param)) $this->setTableByParam($param); if(isset($attributes['param']) && $attributes['param'] > 0) $this->setTableByParam($attributes['param']); $this->createTable($this->table); parent::__construct($attributes); } public function setTableByParam($param){ if($param > 0){ $table = $this->prefix_table . '_' . $param; $this->table = $table; } } //创建表 private function createTable($table){ if(! empty($table) && ! Schema::hasTable($table) && Schema::hasTable($this->prefix_table)){ //执行建表语句 DB::statement('create table '. $table .' like ' . $this->prefix_table); } } }