Skip to content

Commit

Permalink
Merge pull request #42 from milwad-dev/2.x
Browse files Browse the repository at this point in the history
[2.x] Add `castAsJson` to Database
  • Loading branch information
nunomaduro committed Nov 30, 2023
2 parents 5fa7931 + 2ee00bd commit 8fc3221
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,13 @@ function expectsDatabaseQueryCount(int $excepted, string $connection = null)
{
return test()->expectsDatabaseQueryCount(...func_get_args());
}

/**
* Cast a JSON string to a database compatible type.
*
* @return TestCase
*/
function castAsJson(array|object|string $value)
{
return test()->castAsJson($value);
}

0 comments on commit 8fc3221

Please sign in to comment.