Merhaba arkadaşlar post id verisini almak istiyorum fakat null değeri geliyor. Yardımcı olur musunuz?
Article
<article class="post hentry video" data-postid="{{ $post-> id }}">
<div class="post__author author vcard inline-items">
<img src="/vendor/img/avatar7-sm.jpg" alt="author">
<div class="author-date">
<a class="h6 post__author-name fn" href="#">{{$post->user->firstname}} {{$post->user->surname}}</a> ({{$post->user->username}})
<div class="post__date">
<time class="published" datetime="2004-07-24T18:18">
{{$post->created_at}}
</time>
</div>
</div>
@if(Auth::user() == $post->user)
<div class="more"><svg class="olymp-three-dots-icon"><use xlink:href="/vendor/icons/icons.svg#olymp-three-dots-icon"></use></svg>
<ul class="more-dropdown">
<li>
<a href="#">Favorilere Ekle(Yapım Aşamasında)</a>
</li>
<li>
<a href="{{ route('post.delete', ['post_id' => $post->id]) }}">Sil</a>
</li>
</ul>
</div>
@endif()
</div>
<div class="interaction post-additional-info inline-items">
<p style="width: 100%">{{$post->body }}</p>
<a href="#" class="post-add-icon inline-items">
<svg class="olymp-heart-icon"><use xlink:href="/vendor/icons/icons.svg#olymp-heart-icon"></use></svg>
<span>18</span>
</a>
<a href="#" class="post-add-icon inline-items">
<i class="fas fa-thumbs-down"></i>
<span>5</span>
</a>
<div class="gon">
@if(Auth::user() == $post->user)
<button type="button" class="edit but-oni btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Düzenle
</button>
<a href="{{ route('post.delete', ['post_id' => $post->id]) }}" class="but-oni btn btn-primary">
SİL
</a>
@endif
</div>
<div class="comments-shared">
<a href="#" class="post-add-icon inline-items">
<svg class="olymp-speech-balloon-icon"><use xlink:href="/vendor/icons/icons.svg#olymp-speech-balloon-icon"></use></svg>
<span>2</span>
</a>
</div>
</div>
</article>
Rota
Route::post('/edit', function(\Illuminate\Http\Request $request){
return response()->json(['message' => $request['postId']]);
})->name('edit');
JS
var postId = 0;
$('.post').find('.interaction').find('.edit').on('click', function (event){
event.preventDefault();
var postBody = event.target.parentNode.parentNode.childNodes[1].textContent;
postId = event.target.parentNode.parentNode.dataset['postid'];
$('#post-body').val(postBody);
$('#exampleModal').modal();
});
$('#modal-save').on('click', function () {
$.ajax({
method: 'POST',
url: url,
data: {body: $('#post-body').val(), postId: postId, _token: token}
})
.done(function (msg) {
console.log(msg['message']);
});
});