0
When I gave this command echo $user->cards appeared this:
[{"id":10,"id_user":2,"id_card":"11222","created_at":null,"updated_at":null,"deleted_at":null}]
How to access the deleted_at property of this object ?
0
When I gave this command echo $user->cards appeared this:
[{"id":10,"id_user":2,"id_card":"11222","created_at":null,"updated_at":null,"deleted_at":null}]
How to access the deleted_at property of this object ?
3
When using json_decode, the string generates an Object within an array. See below how to proceed:
$str = '[{"id":10,"id_user":2,"id_card":"11222","created_at":null,"updated_at":null,"deleted_at":null}]';
$arr = json_decode($str);
$deleted_at = $arr[0]->deleted_at;
if (is_null($deleted_at)) {
echo 'Nulo';
} else {
echo 'Não nulo';
}
This will display "Null".
Browser other questions tagged php laravel
You are not signed in. Login or sign up in order to post.
Possible duplicate of Access direct key
– adventistaam