<?php $errors = session('errors'); ?>

<?php if (session('success')): ?>
    <div class="alert alert-success"><?= esc(session('success')) ?></div>
<?php endif; ?>

<?php if (session('error')): ?>
    <div class="alert alert-danger"><?= esc(session('error')) ?></div>
<?php endif; ?>

<?php if (is_array($errors) && $errors !== []): ?>
    <div class="alert alert-danger">
        <ul class="error-list">
            <?php foreach ($errors as $error): ?>
                <li><?= esc(is_string($error) ? $error : (string) $error) ?></li>
            <?php endforeach; ?>
        </ul>
    </div>
<?php endif; ?>
