Last active
June 27, 2021 15:06
-
-
Save jdefez/63a04c7a9e8efc53a4f87b6fdc5f0dc8 to your computer and use it in GitHub Desktop.
laravel-directives
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // tobe inserted in AppServiceProvider@boot method | |
| Blade::directive('selected', function ($expression) { | |
| return "<?php echo {$expression} ? 'selected' : ''; ?>"; | |
| }); | |
| Blade::directive('checked', function ($expression) { | |
| return "<?php echo {$expression} ? 'checked' : ''; ?>"; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment