I'm working with Laravel 5 and I've the following HTML pages:
HTML 1
<div class="row">
@foreach($postList as $post)
@include('Pages.Post.postInGroup', ['post'=>$post])
@endforeach
</div>
HTML 2
<div class="publication_item col-lg-12">
<div class="row align-items-center">
<div class="col-9 col-sm-9 col-md-10 col-lg-10 col-xl-11">
<img src="" style="border-radius: 50%;" width="30" height="30" alt="User Picture">
Posted by: <span class="textLighter"></span>
</div>
<div class="col-3 col-sm-3 col-md-2 col-lg-2 col-xl-1" align="right">
@if($post->user->id === Auth::user()->id)
<a href="#" role="button" data-toggle="modal" data-target="#editPost"><i class="ion-edit"></i></a>
@endif
</div>
</div>
<hr>
<!-- first row -->
<div class="row">
<div class="col-9 col-sm-9 col-md-10 col-lg-10 col-xl-11" data-toggle="modal"></div>
</div>
<hr>
<!-- second row -->
<div class="row align-items-center">
<div class="col-3 col-sm-3 col-md-2 col-lg-2 col-xl-1" style="display: inline-block;">
<img src="" style="border-radius: 50%;" width="30" height="30" alt="User Picture">
</div>
<div class="col-9 col-sm-9 col-md-6 col-lg-6 col-xl-9" style="display: inline-block;">
<input type="text" class="form-control" placeholder="Post a comment">
</div>
<div class="col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1" > <!--style="display: inline-block; margin-right: 1px;"-->
<a href="#" id="btn-comment" dusk="commentButton" class="btn btn-primary" role="button" data-toggle="modal" data-target="#addComment" style="background-color: #228B22;">
Comment
</a>
</div>
</div>
Edit Post × Update
DeleteThe HTML 1
page adds cyclically posts, which are built in HTML 2
style. A post is characterized by having an author
and a content (text)
. The HTML 2
page adds to each post the following button for editings:
@if($post->user->id === Auth::user()->id)
<a href="#" role="button" data-toggle="modal" data-target="#editPost"><i class="ion-edit"></i></a>
@endif
That opens the modal below, containing 2 buttons (Update
and Delete
), and a textarea
containing the text of the post, but for some strange reason when I click on any edit button
of different posts, it always shows me the content of the last post inserted. How can I solve?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2rcQ2jj
via IFTTT
Aucun commentaire:
Enregistrer un commentaire