class Js implements Htmlable, Stringable (View source)
| protected REQUIRED_FLAGS | Flags that should be used when encoding to JSON. |
| protected string | $js | The JavaScript string. |
| void | __construct(mixed $data, int|null $flags = 0, int $depth = 512)
Create a new class instance. | |
| static Js | from(mixed $data, int $flags = 0, int $depth = 512)
Create a new JavaScript string from the given data. | |
| string | convertDataToJavaScriptExpression(mixed $data, int $flags = 0, int $depth = 512)
Convert the given data to a JavaScript expression. | |
| static string | encode(mixed $data, int $flags = 0, int $depth = 512)
Encode the given data as JSON. | |
| string | convertJsonToJavaScriptExpression(string $json, int $flags = 0)
Convert the given JSON to a JavaScript expression. | |
| string | toHtml()
Get the string representation of the data for use in HTML. | |
| string | __toString()
Get the string representation of the data for use in HTML. |
Create a new class instance.
Create a new JavaScript string from the given data.
Convert the given data to a JavaScript expression.
Encode the given data as JSON.
Convert the given JSON to a JavaScript expression.
Get the string representation of the data for use in HTML.
Get the string representation of the data for use in HTML.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/11.x/Illuminate/Support/Js.html