got this error "htmlspecialchars() expects parameter 1 to be string, object given" when i try to json_decode in blade file

Posted 8 months ago by afghany

here is my response data { Collection {#478 ▼ #items: array:5 [▼ 0 => modifyHistory {#479 ▼ #attributes: array:8 [▼ "id" => 8 "user_id" => 91 "modified_id" => 6 "modified_type" => "App\Thread" "before" => "{"slug":"one-more-try-6","title":"one more try"}" "after" => "{"slug":"one-more-try2-6","title":"one more try2"}" "created_at" => "2018-04-17 14:45:06" "updated_at" => "2018-04-17 14:45:06" ] #original: array:8 [▶]

}

}

and here is my blade code

@forelse($history as $key => $modify)

                            <li class="list-group-item">

                                <div class="level">

                                    <tr>

                                        <td> {{json_decode($modify->before)}} </td>


                                    </tr>


                                </div>

                            </li>

                        @empty

                            <strong>There is no updates for this thread </strong>

                        @endforelse

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.