<?php $__env->startSection('title', 'Blogs'); ?>

<?php $__env->startSection('content_header'); ?>
    <h1>All Blogs</h1>
    <a href="<?php echo e(route('admin.blogs.create')); ?>" class="btn btn-primary float-right">Add Blog</a>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="card">
    <div class="card-body">
        <?php if(session('success')): ?>
            <div class="alert alert-success"><?php echo e(session('success')); ?></div>
        <?php endif; ?>

        <table class="table table-bordered table-striped">
            <thead>
                <tr>
                    <th>#</th>
                    <th>Title</th>
                    <th>Slug</th>
                    <th>Featured</th>
                    <th>Published At</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $blogs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $blog): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr>
                        <td><?php echo e($loop->iteration + ($blogs->currentPage()-1)*$blogs->perPage()); ?></td>
                        <td><?php echo e($blog->title); ?></td>
                        <td><?php echo e($blog->slug); ?></td>
                        <td><?php echo e($blog->is_featured ? 'Yes' : 'No'); ?></td>
                        <td><?php echo e($blog->published_at?->format('Y-m-d') ?? '-'); ?></td>
                        <td>
                            <a href="<?php echo e(route('admin.blogs.edit', $blog->id)); ?>" class="btn btn-sm btn-info">Edit</a>
                            <form action="<?php echo e(route('admin.blogs.destroy', $blog->id)); ?>" method="POST" style="display:inline-block;">
                                <?php echo csrf_field(); ?>
                                <?php echo method_field('DELETE'); ?>
                                <button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Delete this blog?')">Delete</button>
                            </form>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="6" class="text-center">No blogs found</td>
                    </tr>
                <?php endif; ?>
            </tbody>
        </table>

        <div class="mt-3">
            <?php echo e($blogs->links()); ?>

        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('adminlte::page', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /usr/local/var/www/memafarms/resources/views/admin/blogs/index.blade.php ENDPATH**/ ?>