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
Try checking if the variable is empty:
@if(empty($myvar)) Data does not exist @else Your data is here! @endif
Data does not exist
Your data is here!
Can also check this thread