My Blog Posts

Laravel Blade Helper

Laravel Blade Helper


 

When creating new custom Blade instructions using the Blade :: directive (...) method, the only parameter that can be used to process is the expression transmitted as a raw string from the .blade.php file. It is rare for developers to parse the content of the expression within the directive, instead choosing to pass the entire expression as an argument function or as an argument in another class.

Eg:

BladeHelper::directive('uppercase', function($expression) {
    return "";
});

Because this appears to be the most common use case, this package tries to help make identifying these auxiliary functions a little easier without rotating the rope or having to think about what an expression might be when creating an instruction.

Read me There are plenty of useful examples such as defining the directive and the function of searches. In this example, the instruction is strtouppercalls the built-in function:


 



Share this article


Comments (0)

Comment