Skip to content

Conversation

halloei
Copy link
Contributor

@halloei halloei commented Jun 21, 2021

Currently one's not able to use objects with castAsJson():

ErrorException: PDO::quote() expects parameter 1 to be string, object given

The following code can be used to reproduce the bug:

    $this->assertDatabaseHas('table', [
        'column' => $this->castAsJson((object)[
            'foo' => 'bar',
        ]),
    ]);

@taylorotwell taylorotwell merged commit ad15cf5 into laravel:8.x Jun 21, 2021
@GrahamCampbell GrahamCampbell changed the title Encode objects when casting as JSON [8.x] Encode objects when casting as JSON Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants