firstOrCreate、firstOrNew方法当model重写__construct后会失效
public function __construct()
{
$this->setConnection(\App\Logic\Data\PlatformInitLogic::getPlatformConnect($this- >getTable()));
}
$model = new \App\Model\MinishopConfigModel;
$model->setConnection(\App\Logic\Data\PlatformInitLogic::getPlatformConnect($model->getTable()));
用下面的方法使用firstOrCreate、firstOrNew才可以正常使用.
推荐文章: