<?php
/**
 * @var string $resources
 * @var \Illuminate\Database\Eloquent\Collection $posts
 */

$flag = 0;
?>
<div class="banner_section layout_padding">
    <div id="my_slider" class="carousel slide" data-ride="carousel">
        <div class="carousel-inner">
            <?php foreach ($posts as $key => $post): ?>
            <?php /** @var \kernel\modules\post\models\Post $post */ ?>
                <div class="carousel-item <?= $flag === 0 ? 'active' : '' ?>">
                    <div class="container">
                        <div class="row">
                            <div class="col-md-6">
                                <h1 class="banner_taital main_slider_title"><?= $post->title ?></h1>
                                <div class="read_bt"><a href="/post/<?= $post->id ?>">Читать</a></div>
                            </div>
                            <div class="col-md-6">
                                <div class="banner_img"><img src="<?= $resources ?>/images/slide_img.jpg"></div>
                            </div>
                        </div>
                    </div>
                </div>
                <?php $flag++; ?>
            <?php endforeach; ?>
        </div>
        <a class="carousel-control-prev" href="#my_slider" role="button" data-slide="prev">
            <i class="fa fa-angle-left"></i>
        </a>
        <a class="carousel-control-next" href="#my_slider" role="button" data-slide="next">
            <i class="fa fa-angle-right"></i>
        </a>
    </div>
</div>
