phplaravellaravel-10php-8.1

Laravel query wrong format of value


I'm currently develop a web application with Laravel. My database engine is a Microsoft SQL Server.

For some data I preferred to generate an uuid. When I use Windows to run my Laravel app, the uuid format is correct :

But when I ran my Laravel app under linux, and use the same database, the uuid format is like this :

I don't know where is the problem... Have you an idea ?

Thanks.

The goal is to retrieve the same format when the Laravel app ran under Windows and under Linux.


Solution

  • in your config/database.php add this

    'options' => [
    PDO::DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER => true,
    ],
    

    enter image description here then optimize:clear your app