Skip to content

1.2.0

Compare
Choose a tag to compare
@JohnathonKoster JohnathonKoster released this 01 Feb 01:26
· 2 commits to main since this release
ca1dfaf

Adds a new Directive::callback method that can be used to author Blade directives as if they were just normal PHP methods:

The PHP code can now become:

<?php

use Stillat\BladeDirectives\Support\Facades\Directive;
use Illuminate\Support\Str;

Directive::callback('limit', function ($value, $limit = 100, $end = '...') {
    return Str::limit($value, $limit, $end);
});

and our Blade templates can now be written like so:

@limit($myString, end: '---')