Actually, i confused to ask about the title for my problem.

i have the table comment like this

Schema::create('comments', function (Blueprint $table) {

and my relationship to show reply from parent_id in Comment Model like this.

public function myreplyfrom()
    return $this->belongsTo(Comment::class,'parent_id')->select('body');

i show body comment in blade like this

@foreach($mycomments as $comment)                        
    <p> Reply from Comment-> {{ $comment->myreplyfrom }} </p>    

my comment table like this my comment table

and my comment dashboard like this my comment dashboard

what i've done is right to show the body of comment, but i want to remove {"body"}, so just comment without array and field title.

the result i expected is Reply from Comment-> sdsds and Reply from Comment-> woww

how to fix my problem??

1 Answers

Rajat Sharma On Best Solutions

You should use this in view for comment body of reply

@foreach($mycomments as $comment)
<p> Reply from Comment-> {{ $comment->myreplyfrom->body }} </p>