📝 About
💬 Life Quote
"{{ parseMaybeJsonSingle($profile->life_quote) }}"
@extends('layouts.portal') @section('content') @php // Helper: decode JSON if the value is JSON, otherwise return as-is (or explode by comma) if (!function_exists('parseMaybeJson')) { function parseMaybeJson($value) { if (empty($value)) return []; $decoded = json_decode($value, true); if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) { // Flatten in case of nested arrays or key-value JSON return array_map(function($item) { return is_array($item) ? implode(', ', $item) : $item; }, $decoded); } // Not JSON — fallback to comma-separated string return array_map('trim', explode(',', $value)); } } if (!function_exists('parseMaybeJsonSingle')) { function parseMaybeJsonSingle($value) { if (empty($value)) return null; $decoded = json_decode($value, true); if (json_last_error() === JSON_ERROR_NONE) { if (is_array($decoded)) { return implode(', ', $decoded); } return $decoded; } return $value; } } @endphp
"{{ parseMaybeJsonSingle($profile->life_quote) }}"