Vilfago

Let us know, and if it's not working, var_dump $before ;)

afghany

@Vilfago same error ...

Can't var_dump $before cuz there is a error "htmlspecialchars() expects parameter 1 to be string, array given"

here is the var_dump for $modify

object(App\modifyHistory)#479 (25) { ["guarded":protected]=> array(0) { } ["connection":protected]=> string(5) "mysql" ["table":protected]=> NULL ["primaryKey":protected]=> string(2) "id" ["keyType":protected]=> string(3) "int" ["incrementing"]=> bool(true) ["with":protected]=> array(0) { } ["withCount":protected]=> array(0) { } ["perPage":protected]=> int(15) ["exists"]=> bool(true) ["wasRecentlyCreated"]=> bool(false) ["attributes":protected]=> array(8) { ["id"]=> int(8) ["user_id"]=> int(91) ["modified_id"]=> int(6) ["modified_type"]=> string(10) "App\Thread" ["before"]=> string(48) "{"slug":"one-more-try-6","title":"one more try"}" ["after"]=> string(50) "{"slug":"one-more-try2-6","title":"one more try2"}" ["created_at"]=> string(19) "2018-04-17 14:45:06" ["updated_at"]=> string(19) "2018-04-17 14:45:06" } ["original":protected]=> array(8) { ["id"]=> int(8) ["user_id"]=> int(91) ["modified_id"]=> int(6) ["modified_type"]=> string(10) "App\Thread" ["before"]=> string(48) "{"slug":"one-more-try-6","title":"one more try"}" ["after"]=> string(50) "{"slug":"one-more-try2-6","title":"one more try2"}" ["created_at"]=> string(19) "2018-04-17 14:45:06" ["updated_at"]=> string(19) "2018-04-17 14:45:06" } ["casts":protected]=> array(0) { } ["dates":protected]=> array(0) { } ["dateFormat":protected]=> NULL ["appends":protected]=> array(0) { } ["events":protected]=> array(0) { } ["observables":protected]=> array(0) { } ["relations":protected]=> array(0) { } ["touches":protected]=> array(0) { } ["timestamps"]=> bool(true) ["hidden":protected]=> array(0) { } ["visible":protected]=> array(0) { } ["fillable":protected]=> array(0) { } }

Vilfago

Why don't you have the same object as before ? Did you var_dump it after another operation?

Another idea to try... because I'm desperate :

@php
dump($modify->before);
$before = $modify->before;
dump($before);
$json_before = json_decode($before, true);
dump($json_before);
@endphp

{{ $json_before['slug'] }}
Snapey
Snapey
5 months ago (1,044,305 XP)

use (as an object)

{{ json_decode($modify->before)->title }} <br />
{{ json_decode($modify->before)->slug }}

or (as an array)

{{ json_decode($modify->before,true)['title'] }} <br />
{{ json_decode($modify->before,true)['slug'] }}
afghany

@Snapey thanks it's work ?

afghany

Thanks @Vilfago for your help :) And nah i am not var_dump after another operation

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