ivanleoncz69
1 month ago
135
3
Laravel

Check whether the json value is empty or not

Posted 1 month ago by ivanleoncz69

I have a JSON data in the table field. For example, -

[
	'send_message_via': 'web'
]

Or if it is empty, then will be like that-

[]

Now, I am getting data this way-

$configuration = json_decode(shop()->setting->whatsapp_configuration, true)->send_message_via;

Now, if it is empty like this [], then I am getting error. Otherwise work fine.

How can I check whether it's empty or not. If not empty, then only display the send_message_via.

Thanks in advanced.

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