【问题标题】:Does Laravel support the use of table prefixes?Laravel 是否支持使用表前缀?
【发布时间】:2019-07-07 01:56:59
【问题描述】:

我在 config/database 和 .env 以及 phpmyadmin 中设置了前缀 但是当我访问我的本地主机时,它会显示 xyz ,abc,(tables name) 不存在的消息

【问题讨论】:

标签: laravel


【解决方案1】:

您必须按照here 所述配置模型中的表名

class Flight extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'my_flights';
}

【讨论】:

    【解决方案2】:

    您可以在config/database.php中设置表前缀,

    'prefix' => 'myprefix',
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-05
      • 2022-01-22
      • 2018-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-16
      相关资源
      最近更新 更多