Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 749 Bytes

directives.md

File metadata and controls

39 lines (28 loc) · 749 Bytes
title subtitle
Directives
Develop

Directives Development

Creating directives

Create a class that implements Radic\BladeExtensions\Directives\DirectiveInterface or extends Radic\BladeExtensions\Directives\AbstractDirective.

namespace App\Directives;

use Radic\BladeExtensions\Directives\AbstractDirective;

class IfSectionDirective extends AbstractDirective {
    protected $replace = '$1<?php if($section){ ?>$2';
}

Add to config/blade-extensions.php

return [
    'directives' => [
        'ifSection' => 'App\Directives\IfSectionDirective',
        // other directives...
    ]
];

Examples

Check the classes in Radic\BladeExtensions\Directives