简体   繁体   English

Laravel 宅基地更改 UUID

[英]Laravel Homestead Changing UUID

We did not start initially using Laravel Homestead, but are working on getting homestead set up to make version control easier.我们最初并未开始使用 Laravel Homestead,但正在努力设置 homestead 以使版本控制更容易。

Everything seems to be working fine other than my UUIDs are being encoded strangely.除了我的 UUID 被奇怪地编码之外,一切似乎都运行良好。

Production Environment:生产环境:

Illuminate\Support\Collection {#681 ▼
    `#items: array:148 [▼
        0 => {#685 ▼
            +"MyId": "D281ACC2-1F3D-470E-9CBD-26957763F197"
            +"TheirId": "43499884-2C18-4591-BDF1-D994DDDD1314"

Local Environment:当地环境:

Illuminate\Support\Collection {#681 ▼
    `#items: array:148 [▼
        0 => {#685 ▼
            +"MyId": b"ê1÷ÞhÙéDÉï\x01³ú'┌á"
            +"TheirId": b"pE;¿_J]EòØö▀i#8¾"

Codebases are identical.代码库是相同的。 The only thing I can think of is the Vagrant box using a different sqlsrv driver, so I have installed pdo_sqlsrv but it has not fixed the issue.我唯一能想到的是 Vagrant 盒子使用不同的 sqlsrv 驱动程序,所以我安装了 pdo_sqlsrv 但它没有解决问题。

Any ideas?有任何想法吗?

I found what seems to be a fix.我发现似乎是一个修复。 I appended the options array.我附加了options数组。

    'sqlsrv' => [
        'driver' => 'sqlsrv',
        'host' => env('DB_HOST', 'localhost'),
        'port' => env('DB_PORT', '1433'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8',
        'prefix' => '',
        'prefix_indexes' => true,
        'options'  => [
            // Used for GUIDs
            PDO::DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER => true,
        ],
    ],

Answer was stolen from @tom-sinclair https://github.com/laravel/homestead/issues/823#issuecomment-391619635答案从@tom-sinclair https://github.com/laravel/homestead/issues/823#issuecomment-391619635被盗

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM