{{--
Name: partials.alert.blade
Author: JH2
Created: 2015-09-22
Description: This partial will pop alert modal windows if session is set
Flash values are written as JSON string literals so quotes and cannot break out of the
script (#3092). SweetAlert2 6.9.1 writes `title` with innerHTML, so the title is passed as
`titleText` (innerText) and the message as `text` (textContent); both show as plain text. toastr
inserts HTML, so its values are HTML-escaped first and show as plain text, as on the reskinned
layouts. Invalid UTF-8 is substituted so json_encode() never returns false.
--}}
@php
$nhAlertJs = function ($value, bool $html = false) {
$value = is_scalar($value) ? (string) $value : '';
return json_encode(
$html ? e($value) : $value,
JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_SUBSTITUTE
) ?: '""';
};
@endphp
@if(Session::has('message'))
@endif
@if(Session::has('toastr'))
@endif