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

<?php $__env->startSection('content_header'); ?>
    <h1>Edit Blog</h1>
    <a href="<?php echo e(route('admin.blogs.index')); ?>" class="btn btn-secondary float-right">Back to Blogs</a>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="card">
    <div class="card-body">
        <form action="<?php echo e(route('admin.blogs.update', $blog->id)); ?>" method="POST" enctype="multipart/form-data">
            <?php echo csrf_field(); ?>
            <?php echo method_field('PUT'); ?>

            <div class="form-group">
                <label for="title">Title</label>
                <input type="text" name="title" class="form-control" id="title" value="<?php echo e(old('title', $blog->title)); ?>" required>
            </div>

            <div class="form-group">
                <label for="slug">Slug</label>
                <input type="text" name="slug" class="form-control" id="slug" value="<?php echo e(old('slug', $blog->slug)); ?>" required>
            </div>

            <div class="form-group">
                <label for="excerpt">Excerpt</label>
                <textarea name="excerpt" class="form-control" id="excerpt" rows="2"><?php echo e(old('excerpt', $blog->excerpt)); ?></textarea>
            </div>

            <div class="form-group">
                <label for="content">Content</label>
                <textarea name="content" class="form-control" id="content" rows="5"><?php echo e(old('content', $blog->content)); ?></textarea>
            </div>

            <div class="form-group">
                <label for="published_at">Published At</label>
                <input type="date" name="published_at" class="form-control" id="published_at" value="<?php echo e(old('published_at', optional($blog->published_at)->format('Y-m-d'))); ?>">
            </div>

            <div class="form-group">
                <label for="is_featured">Featured</label>
                <select name="is_featured" id="is_featured" class="form-control">
                    <option value="0" <?php echo e(old('is_featured', $blog->is_featured) == 0 ? 'selected' : ''); ?>>No</option>
                    <option value="1" <?php echo e(old('is_featured', $blog->is_featured) == 1 ? 'selected' : ''); ?>>Yes</option>
                </select>
            </div>

            <div class="form-group">
                <label for="image">Image</label>
                <?php if($blog->image): ?>
                    <div class="mb-2">
                        <img src="<?php echo e(asset('storage/'.$blog->image)); ?>" alt="Blog Image" width="150">
                    </div>
                <?php endif; ?>
                <input type="file" name="image" class="form-control-file" id="image">
            </div>

            <button type="submit" class="btn btn-primary">Update Blog</button>
        </form>
    </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/edit.blade.php ENDPATH**/ ?>