I'm trying to add a custom directive to blade. I use the example form the docs and added the following code:
AppServiceProvider.php
Blade::directive('datetime', function ($expression) {
return "<?php echo ($expression)->format('m/d/Y H:i'); ?>";
});
home.blade.php
{{ @datetime(new \DateTime()) }}
after running view:clear and browse to the page, I've got this error at the directive line:
Facade\Ignition\Exceptions\ViewException syntax error, unexpected '<' (View: /var/www/html/resources/views/home.blade.php)