Skip to content

Commit ba46acb

Browse files
bert-wtaylorotwell
andauthored
[10.x] Expose Js::json() helper (#46935)
* change to static * Update Js.php --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 2aff286 commit ba46acb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Illuminate/Support/Js.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected function convertDataToJavaScriptExpression($data, $flags = 0, $depth =
7474
$data = $data->value;
7575
}
7676

77-
$json = $this->jsonEncode($data, $flags, $depth);
77+
$json = static::encode($data, $flags, $depth);
7878

7979
if (is_string($data)) {
8080
return "'".substr($json, 1, -1)."'";
@@ -93,7 +93,7 @@ protected function convertDataToJavaScriptExpression($data, $flags = 0, $depth =
9393
*
9494
* @throws \JsonException
9595
*/
96-
protected function jsonEncode($data, $flags = 0, $depth = 512)
96+
public static function encode($data, $flags = 0, $depth = 512)
9797
{
9898
if ($data instanceof Jsonable) {
9999
return $data->toJson($flags | static::REQUIRED_FLAGS);

0 commit comments

Comments
 (0)