Open andrew-m-p opened 3 days ago
Cannot get the example to work:
app()->blade()->directive('datetime', function ($expression) { return "<?php echo with({$expression})->format('F d, Y g:i a'); ?>"; });
Which allows you to use the following in your blade template:
Current date: @datetime(date())
It says ""Call to a member function directive() on null""
It is a bug I get "Call to a member function directive() on null"" The reason is that configure in\leaf\blade is not being called first to set $this->blade
Need to hack with a call to configure first before directive()
Leaf\Config::get("views.blade")->configure(AppConfig('views.path'), AppConfig('views.cachePath'));
Ended up using $blade = new Blade( AppConfig('views.path'), AppConfig('views.cachePath')); Then $blade->directive('selectlanguage',[GlobalHelpers::class,'selectlanguage']);
echo self::$blade->make('mycontroller', $data)->render();
Al least I could get the directive to work
Hello. This is not a bug I need info on using blade module.
I want to create components , where am I expected to put this in the app ?
app()->blade()->directive('datetime', function ($expression) { return "<?php echo with({$expression})->format('F d, Y g:i a'); ?>"; });
Can I create a component like this instead ? with alert.blade.php
Thanks in advance