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
To check if variable exist in Laravel blade directive, do this:
Blade::directive('datetime', function ($value) { return "format('d/m/Y H:i:s') : null; ?>"; });