こんにちは、投稿のリストと各投稿の 2 つのボタン (削除と編集) を含むテーブルがあります。 jqueryコード:
<script type="text/javascript">
$(function() {
$("#myForm").submit(function() {
$("textarea").each(function(){
new nicEditors.findEditor(this.id).saveContent();
});
});
});
</script>
これは私の見解です:
@foreach($articles as $post)
<tr>
<td>{{$post->title}}</td>
<td>{{$post->published_at}}</td>
<td><p data-placement="top" data-toggle="tooltip" title="Edit"><button class="btn btn-primary btn-xs" data-title="Edit" data-toggle="modal" data-target="#edit{{$post->id}}" ><span class="fa fa-pencil"></span></button></p></a></td></a>
<td><p data-placement="top" data-toggle="tooltip" title="Delete"><button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal" data-target="#delete{{$post->id}}" ><span class="fa fa-trash"></span></button></p></td>
<div class="modal fade" id="edit{{$post->id}}" tabindex="-1" role="dialog" aria-labelledby="edit" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
<h4 class="modal-title custom_align" id="Heading">Edit l'article : {{$post->id}}</h4>
</div>
<div class="modal-body">
{!! Form::model($post,['method' => 'PATCH','files'=> true,'id'=>'myForm','route' => ['articles.update', $post->id]])!!}
@include('partials.postForm')
</div>
</tr>
@endforeach