관리-도구
편집 파일: aboutgallery.blade.php
@extends('layouts.app') @section('content') <div class="main-panel"> <div class="content-wrapper"> <div class="d-flex justify-content-between mb-3"> <h3><b>About Gallery</b></h3> <button class="btn btn-success" data-toggle="modal" data-target="#addGallery"> Add Gallery + </button> </div> <!-- Add Modal --> <div class="modal fade" id="addGallery"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content"> <form method="POST" action="{{ route('admin-aboutgallery.store') }}" enctype="multipart/form-data"> @csrf <div class="modal-header"> <h5>Add Gallery</h5> <button type="button" class="close" data-dismiss="modal">×</button> </div> <div class="modal-body"> <div class="form-group"> <label>Title</label> <input type="text" name="title" class="form-control" required> </div> <div class="form-group"> <label>Image</label> <input type="file" name="image" class="form-control" required> </div> </div> <div class="modal-footer"> <button class="btn btn-success w-100">Submit</button> </div> </form> </div> </div> </div> <!-- Table --> <div class="table-responsive"> <table class="table table-hover"> <thead> <tr> <th>#</th> <th>Title</th> <th>Image</th> <th class="text-center">Action</th> </tr> </thead> <tbody> @foreach($galleries as $gallery) <tr> <td>{{ $loop->iteration }}</td> <td>{{ $gallery->title }}</td> <td> <img src="{{ asset('storage/'.$gallery->image) }}" width="80"> </td> <td class="text-center"> <button class="btn btn-primary" data-toggle="modal" data-target="#edit{{ $gallery->id }}"> <i class="fa fa-edit"></i> </button> <form action="{{ route('admin-aboutgallery.destroy',$gallery->id) }}" method="POST" class="d-inline"> @csrf @method('DELETE') <button class="btn btn-danger"> <i class="fa fa-trash"></i> </button> </form> </td> </tr> <!-- Edit Modal --> <div class="modal fade" id="edit{{ $gallery->id }}"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content"> <form method="POST" action="{{ route('admin-aboutgallery.update',$gallery->id) }}" enctype="multipart/form-data"> @csrf @method('PUT') <div class="modal-header"> <h5>Update Gallery</h5> <button type="button" class="close" data-dismiss="modal">×</button> </div> <div class="modal-body"> <div class="form-group"> <label>Title</label> <input type="text" name="title" value="{{ $gallery->title }}" class="form-control" required> </div> <div class="form-group"> <label>Image</label> <input type="file" name="image" class="form-control"> </div> <img src="{{ asset('storage/'.$gallery->image) }}" width="100"> </div> <div class="modal-footer"> <button class="btn btn-primary w-100">Update</button> </div> </form> </div> </div> </div> @endforeach </tbody> </table> </div> </div> @endsection