久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

        <bdo id='m3F5n'></bdo><ul id='m3F5n'></ul>

      <small id='m3F5n'></small><noframes id='m3F5n'>

      <legend id='m3F5n'><style id='m3F5n'><dir id='m3F5n'><q id='m3F5n'></q></dir></style></legend>
      <i id='m3F5n'><tr id='m3F5n'><dt id='m3F5n'><q id='m3F5n'><span id='m3F5n'><b id='m3F5n'><form id='m3F5n'><ins id='m3F5n'></ins><ul id='m3F5n'></ul><sub id='m3F5n'></sub></form><legend id='m3F5n'></legend><bdo id='m3F5n'><pre id='m3F5n'><center id='m3F5n'></center></pre></bdo></b><th id='m3F5n'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='m3F5n'><tfoot id='m3F5n'></tfoot><dl id='m3F5n'><fieldset id='m3F5n'></fieldset></dl></div>
    1. <tfoot id='m3F5n'></tfoot>

      Laravel 6 config()->get('database.connections.mysql

      Laravel 6 config()-gt;get(#39;database.connections.mysql#39;) not matching DB:connection()(Laravel 6 config()-get(database.connections.mysql) 與 DB:connection() 不匹配)
      • <tfoot id='N9OCw'></tfoot>

        • <bdo id='N9OCw'></bdo><ul id='N9OCw'></ul>

              <tbody id='N9OCw'></tbody>

            <i id='N9OCw'><tr id='N9OCw'><dt id='N9OCw'><q id='N9OCw'><span id='N9OCw'><b id='N9OCw'><form id='N9OCw'><ins id='N9OCw'></ins><ul id='N9OCw'></ul><sub id='N9OCw'></sub></form><legend id='N9OCw'></legend><bdo id='N9OCw'><pre id='N9OCw'><center id='N9OCw'></center></pre></bdo></b><th id='N9OCw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='N9OCw'><tfoot id='N9OCw'></tfoot><dl id='N9OCw'><fieldset id='N9OCw'></fieldset></dl></div>

            1. <legend id='N9OCw'><style id='N9OCw'><dir id='N9OCw'><q id='N9OCw'></q></dir></style></legend>

              <small id='N9OCw'></small><noframes id='N9OCw'>

                本文介紹了Laravel 6 config()->get('database.connections.mysql') 與 DB:connection() 不匹配的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                在我的本地環境中,我使用多個租戶和 Redis(需要身份驗證).
                為了服務這個項目,我正在使用 Valet.

                In my local environment I am working with multiple tenants and Redis (Auth required).
                To serve the project I am using Valet.

                對于這種情況,我要解決這兩個連接:

                For this case I am addressing these two connections:

                - basic_foo (is defined in my .env)
                - tenant_foo (is the one to change to during a request)
                

                直到現在我成功地改變了連接:

                Until now I successfully changed the connections like so:

                config()->set('database.connections.mysql', 
                       array_merge(
                        config()->get('database.connections.mysql') , 
                        ['database' => 'tenant_foo']
                    ); 
                

                問題

                但是,現在我發現查詢構建器存在問題,保持或回退到基本連接.

                Problem

                However, now I am seeing an issue with the query builder, keeping or falling back to the basic connection.

                運行時得到tenant_foo的預期連接結果(Redis相同)

                I get the expected connection results of tenant_foo (same for Redis) when I run

                dd(config()->get('database.connections.mysql'));
                

                當我運行時,basic_foo 的結果是錯誤的但顯然是活躍的

                I get the wrong but apparently active results of basic_foo when I run

                dd(DB::connection()); // returns IlluminateDatabaseMySqlConnection
                

                所以總而言之,應用程序將返回這個 IlluminateDatabaseQueryException

                So all in all the app will return this IlluminateDatabaseQueryException

                SQLSTATE[42S02]: Base table or view not found: 1146 Table 'basic_foo.table_bar' doesn't exist...
                

                應該在哪里搜索

                'tenant_foo.table_bar'
                

                還沒有解決問題的事情

                • 重啟Redis
                • 重新安裝Redis
                • php 工匠配置:緩存
                • php artisan 緩存:清除
                • php artisan route:clear
                • php artisan view:clear
                • php artisan 優化
                • 作曲家轉儲自動加載
                • 像下面那樣簡單地將數據庫名稱更改為 tenant_foo 是不夠的,因為配置數組保持與 basic_foo 相同.

                  Simply changing the database name to tenant_foo like below is not enough, as the config array remains the same of basic_foo.

                  DB::connection()->setDatabaseName('tenant_foo');
                  

                  想法

                  • 我想更改 DB::connection() 的配置數組,但我不知道除了 config->set() 之外的其他方法.
                  • 我安裝了 Telescope 這會影響數據庫連接嗎?
                  • 還有其他想法嗎?
                  • Thoughts

                    • I want to change the config-array the of DB::connection(), but I don't know another way than the config->set().
                    • I installed Telescope could this affect the db connection?
                    • Any other ideas?
                    • 推薦答案

                      要動態更改數據庫名稱,您應該使用:

                      To dynamically change database name you should use:

                      DB::disconnect(); 
                      Config::set('database.mysql.database', 'tenant_foo'); 
                      DB::reconnect();
                      

                      這篇關于Laravel 6 config()->get('database.connections.mysql') 與 DB:connection() 不匹配的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                      【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                PHP PDO ODBC connection(PHP PDO ODBC 連接)
                Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
              • <i id='2hotN'><tr id='2hotN'><dt id='2hotN'><q id='2hotN'><span id='2hotN'><b id='2hotN'><form id='2hotN'><ins id='2hotN'></ins><ul id='2hotN'></ul><sub id='2hotN'></sub></form><legend id='2hotN'></legend><bdo id='2hotN'><pre id='2hotN'><center id='2hotN'></center></pre></bdo></b><th id='2hotN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2hotN'><tfoot id='2hotN'></tfoot><dl id='2hotN'><fieldset id='2hotN'></fieldset></dl></div>

                  <legend id='2hotN'><style id='2hotN'><dir id='2hotN'><q id='2hotN'></q></dir></style></legend>

                  <small id='2hotN'></small><noframes id='2hotN'>

                      <bdo id='2hotN'></bdo><ul id='2hotN'></ul>
                        <tbody id='2hotN'></tbody>
                      • <tfoot id='2hotN'></tfoot>
                          主站蜘蛛池模板: 日本一级淫片免费啪啪3 | 国产亚洲欧美另类一区二区三区 | 欧美激情在线精品一区二区三区 | 欧美成人手机在线 | 国产一区二区免费 | 99re视频在线免费观看 | 欧美99久久精品乱码影视 | 亚洲综合五月天婷婷 | av在线视| 久久久av| 亚洲国产视频一区二区 | 久久久久久av | a级片网站 | 亚洲一区久久 | 福利二区| 黄网站在线播放 | 亚洲国产精久久久久久久 | 日韩欧美一区二区三区免费观看 | 91五月天 | 国产成人精品一区二区三区视频 | 亚洲国产一区二区三区 | 日韩在线一区二区三区 | 在线中文视频 | 在线日韩欧美 | 日本高清中文字幕 | 亚洲国产成人精品久久久国产成人一区 | 日韩精品二区 | 成人av在线播放 | 国产精品不卡一区 | 亚洲高清在线 | 伊人久操 | 日韩欧美成人一区二区三区 | 亚洲精品一区二区 | 国产精品久久精品 | 亚洲a视频| 欧美福利三区 | 久久精品网 | 久久天天躁狠狠躁夜夜躁2014 | 日本三级电影在线免费观看 | 久久久久久久国产精品影院 | 欧洲一区在线观看 |