问题描述
//这里是我的控制器
public function show($id){
$comments=Comment::where('post_id',$id)->first();
return view('user',compact('comments'));
}
//这里是我的评论表
public function up()
{
Schema::create('comments',function (Blueprint $table) {
$table->id();
$table->text('description');
$table->integer('commentable_id')->unsigned();
$table->integer('post_id');
$table->string('commentable_type');
$table->timestamps();
});
}
//这是我的刀刃
<div class="post-footer-comment-wrapper" >
<b><p>Şərhlər</p></b>
@foreach($comments as $comment)
<div class="comment-form">
<section class="post-body">
<p>{{ $comment->description }}</p> <!-- burda ilisdim -->
</section>
</div>
<form method="post" action="{{route('comments')}}">
@csrf
<br>
<br>
<label for="comment">Şərh yaz</label><br>
<textarea id="comment " name="comment" rows="3" cols="50">
</textarea>
<input type="hidden" value="{{$post->id}}" name="id">
<button type="submit" class="btn btn-primary">Şərh yaz</button>
</form>
<div class="media-body">
<a href="#" class="anchor-username"><h4 class="media-heading"> </h4></a>
<a href="#" class="anchor-time"> </a>
</div>
</div>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)