<?php

use Illuminate\Support\Facades\DB;
use Illuminate\Database\Query\Builder;
use App\Models\Post;
use App\Models\User;
use App\Models\Like;
use App\Models\Comment;
?>

<?php if (isset($component)) { $__componentOriginal0f509fab02c45445826003a1e50db506 = $component; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.head','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('head'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal0f509fab02c45445826003a1e50db506)): ?>
<?php $component = $__componentOriginal0f509fab02c45445826003a1e50db506; ?>
<?php unset($__componentOriginal0f509fab02c45445826003a1e50db506); ?>
<?php endif; ?>

<body>

    <!-- Wrapper -->
    <div id="wrapper">

        <!-- Header -->
        <?php if (isset($component)) { $__componentOriginal2a2e454b2e62574a80c8110e5f128b60 = $component; } ?>
<?php $component = App\View\Components\Header::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('header'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Header::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal2a2e454b2e62574a80c8110e5f128b60)): ?>
<?php $component = $__componentOriginal2a2e454b2e62574a80c8110e5f128b60; ?>
<?php unset($__componentOriginal2a2e454b2e62574a80c8110e5f128b60); ?>
<?php endif; ?>

        <!-- Menu -->
        <?php if (isset($component)) { $__componentOriginaldadc8f6aa159c05f9151bf94d661e8e3 = $component; } ?>
<?php $component = App\View\Components\Menu::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('menu'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Menu::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginaldadc8f6aa159c05f9151bf94d661e8e3)): ?>
<?php $component = $__componentOriginaldadc8f6aa159c05f9151bf94d661e8e3; ?>
<?php unset($__componentOriginaldadc8f6aa159c05f9151bf94d661e8e3); ?>
<?php endif; ?>

        <!-- Main -->
        <div id="main">
            <!-- Post -->
            <article class="post">

                <header>
                    <div class="title">
                        <h2><a href="<?php echo e(Route('single', $post->id)); ?>">
                                <?php echo e($post->header); ?>

                            </a></h2>
                        <p>
                            <?php echo e($post->subheader); ?>

                        </p>
                    </div>
                    <div class="meta">
                        <time class="published" datetime="<?php echo e($post->datepost); ?>">
                            <?php echo e($post->datepost); ?>

                        </time>
                        <a href="<?php echo e(Route('user', $post->user_id)); ?>" class="author"><span class="name">
                                <?php echo e($user->fullname); ?>

                            </span><img src="/blog_laravel/public/<?php echo e($user->avatar); ?>" alt="Avatar of <?php echo e($user->fullname); ?>" /></a>
                    </div>
                </header>
                <span class="image featured"><img src="/blog_laravel/public/<?php echo e($post->photo); ?>" alt="" /></span>

                <p>
                    <?php echo e($post->anons); ?>

                </p>

                <p>
                    <?php echo e($post->post); ?>

                </p>
                <footer>
                    <?php
                    // Like::count('id');
                    // Comment::count('id');
                    ?>
                    <ul class="stats">
                        <?php if(Auth::id() == $post->user_id): ?>
                        <li><a href="<?php echo e(Route('edit', $post->id)); ?>">Edit</a></li>
                        <li><a href="<?php echo e(Route('deletepost', $post->id)); ?>" class="red">Delete</a></li>
                        <li><a href="<?php echo e(Route('blockpost', $post->id)); ?>" class="red"><?php echo e($messageblock); ?></a></li>
                        <?php endif; ?>
                        <li>
                            <a href="<?php echo e(Route('likes', $post->id)); ?>" class="icon fa-heart">
                                <?php echo e($likes->count()); ?>

                            </a>
                        </li>

                        <li>
                            <a href="#comm" class="icon fa-comment">
                                <?php echo e($comments->count()); ?>

                            </a>
                        </li>
                    </ul>
                </footer>
            </article>
            <!-- Comments -->
            <div class="post">
                <section class="comments">
                    <h3 id="comm">Comments</h3>
                    <form action="<?php echo e(Route('comments', $post->id)); ?>" method="post">
                        <?php echo csrf_field(); ?>
                        <textarea name='comment' style='resize: none;'></textarea><br>
                        <h5 style="text-align: center; color: red;">
                            <?= isset($untitled_comment) ? $untitled_comment : '' ?>
                        </h5>
                        <input type="submit" name="addcomment" class="button big fit" value="Add Comment">
                    </form>
                    <?php $__errorArgs = ["comment"];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                    <div class="alert alert-danger"><?php echo e($message); ?></div>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </section>

                <?php $__currentLoopData = $comments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $comment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <article class="comment">
                    <div class="comment-autor">
                        <a href=""><img src="/blog_laravel/public/<?php echo e($user->avatar); ?>"></a>
                        <a href=""><?php echo e($user->fullname); ?></a>
                    </div>
                    <p>
                        <?php echo e($comment->comment); ?>

                    </p>
                </article>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
        </div>

    </div>

    <!-- Footer -->
    <?php if (isset($component)) { $__componentOriginal8a8716efb3c62a45938aca52e78e0322 = $component; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.footer','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('footer'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8a8716efb3c62a45938aca52e78e0322)): ?>
<?php $component = $__componentOriginal8a8716efb3c62a45938aca52e78e0322; ?>
<?php unset($__componentOriginal8a8716efb3c62a45938aca52e78e0322); ?>
<?php endif; ?>
    <!-- Scripts -->
    <?php if (isset($component)) { $__componentOriginal23a21c0d0f80992980c57ef2802ca540 = $component; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.scripts','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('scripts'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal23a21c0d0f80992980c57ef2802ca540)): ?>
<?php $component = $__componentOriginal23a21c0d0f80992980c57ef2802ca540; ?>
<?php unset($__componentOriginal23a21c0d0f80992980c57ef2802ca540); ?>
<?php endif; ?>
</body>

</html><?php /**PATH C:\xampp\htdocs\blog_laravel\resources\views/single.blade.php ENDPATH**/ ?>