A blog on PHP, JavaScript and more Amit Merchant · July 31, 2020 · ⋆ Laravel There are some features in Blade, which if used appropriately, can make your codebase look more organized and recognizable. One such feature that I recently came across is where one can create their own custom conditional Blade directives which you can use in your codebase. This kind of Blade directives can come in handy if you don’t want to spoil your Blade views by throwing in the complex logic and to make your views much cleaner.
So, if you want to create a custom conditional directive which checks the type of book and returns the boolean result accordingly, you can do it like so.