afghany
2230
21
Laravel

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

Posted 1 year 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.