In Laravel you might pass quite complex data structures to a blade. On Those data structures you might assume that have keys and different levels on writing a blade.
What is the bst practice to handle possible undefined index on the blade code?
Is the only solution to write something like (every time you address a struct in a blade)
<div>{{ $dataStruct['key0001'] ?? '' }}</div> }}
or (multi dimensional)
@isset($dataStruct['key0002'])
<div>{{ $dataStruct['key0002']['name'] ?? '' }}</div> }}
@endisset
To avoid ErrorException "Undefined index: key0001"
Using colasce operator makes sense, but we're gonna spread it along all the code blocks to safely fallback... And sometimes we would like to break at. higher level. So...
E.g. Is there some try catch block approach in order to display a fallback html just in case some of the dataStructure key isn't provided?
Any other idea?