HTML, wenn en in LTR wechselt

<?php
$language = str_replace('_', '-', app()->getLocale());
if ($language == 'ar') {
    $dir = 'rtl';
} else {
    $dir = 'ltr';
}
?>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" dir="<?php echo $dir; ?>">

</html>
Snippets