use Illuminate\Database\Eloquent\Model as Eloquent;
class MessageModel extends Eloquent{
public $table = 'message';
public function getModel($tableName){
return $this->setTable($tableName);
}
}
报错:
[2016-12-18 18:27:33] production.ERROR: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'message' doesn't exist in vendor/laravel/framework/src/Illuminate/Database/Connection.php:457
因为消息表示分表的所以想通过一个model操作所有的分表的表
今天发现这个是自己使用的问题因为我使用了create静态方法我们可以看到基类的定义
所以由此看出凡是改过表名的model都不能再使用静态方法。只能通过其他方法实现