お知らせ登録・編集・削除を実装
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<div class="container">
|
||||
<h2>お知らせの編集</h2>
|
||||
<hr>
|
||||
<form action="{{ route('admin.info.update', ['id' => $info->id]) }}" method="post">
|
||||
<form action="{{ route('admin.info.update', ['info' => $info]) }}" method="post">
|
||||
{{ method_field('PUT') }}
|
||||
{{ csrf_field() }}
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
<label for="category">カテゴリ</label>
|
||||
<select id="category" name="category" class="form-control">
|
||||
@foreach($categories as $id => $category)
|
||||
<option value="{{ $id }}" {{ (old('category') ?? $info->category) == $id ? 'checked' : '' }}>{{ $category['label'] }}</option>
|
||||
<option value="{{ $id }}" {{ (old('category') ?? $info->category) == $id ? 'selected' : '' }}>{{ $category['label'] }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-12 col-lg-6 d-flex flex-column justify-content-center">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input id="pinned" type="checkbox" class="custom-control-input"
|
||||
<input id="pinned" name="pinned" type="checkbox" class="custom-control-input" value="1"
|
||||
{{ (is_bool(old('pinned')) ? old('pinned') : $info->pinned) ? 'checked' : ''}}>
|
||||
<label for="pinned" class="custom-control-label">ピン留め (常に優先表示) する</label>
|
||||
</div>
|
||||
@@ -41,8 +41,12 @@
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<button type="submit" class="btn btn-primary">更新</button>
|
||||
<button type="button" class="btn btn-danger">削除</button>
|
||||
<button type="submit" class="btn btn-danger" form="delete-form">削除</button>
|
||||
</div>
|
||||
</form>
|
||||
<form id="delete-form" action="{{ route('admin.info.destroy', ['info' => $info]) }}" method="post">
|
||||
{{ method_field('DELETE') }}
|
||||
{{ csrf_field() }}
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
Reference in New Issue
Block a user