Skip to content

Commit

Permalink
[10.x] Expose Js::json() helper (laravel#46935)
Browse files Browse the repository at this point in the history
* change to static

* Update Js.php

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
bert-w and taylorotwell committed May 2, 2023
1 parent 2aff286 commit ba46acb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Support/Js.php
Expand Up @@ -74,7 +74,7 @@ protected function convertDataToJavaScriptExpression($data, $flags = 0, $depth =
$data = $data->value;
}

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

if (is_string($data)) {
return "'".substr($json, 1, -1)."'";
Expand All @@ -93,7 +93,7 @@ protected function convertDataToJavaScriptExpression($data, $flags = 0, $depth =
*
* @throws \JsonException
*/
protected function jsonEncode($data, $flags = 0, $depth = 512)
public static function encode($data, $flags = 0, $depth = 512)
{
if ($data instanceof Jsonable) {
return $data->toJson($flags | static::REQUIRED_FLAGS);
Expand Down

0 comments on commit ba46acb

Please sign in to comment.