Laravel create custom directives

Laravel create custom directives

Open app\Providers\AppServiceProvider and add in boot method

public function boot()
{
    Blade::directive('format_currency', function ($number) {
        return "<?php echo money_format("%i", $number); ?>";
    });
}

in blade views use directive as @format_currency(‘2456.26’)

click for more Laravel codes read about laravel extending blade