I\'m trying to create blade directive which echo variable (if variable defined) or echo \"no data\" if variable undefined.
This is my code in AppServiceProvider.ph
AppServiceProvider.ph
The best and cleanest way check if a variable exists in blade:
{!! !empty($myvariable) ? $myvariable : 'variable does not exist' !!}