PHP Blade Directives
Laravel Custom Blade directives for Laravel Applications., (*1)
See https://laravel.com/docs/blade, (*2)
Installation:, (*3)
$ composer require younesi/blade-directives, (*4)
Available directives:
@persianNum
convert latin numbers to their persian equvalent, (*5)
@persianNum('Persian Numbers 9123456780 اعداد فارسی')
//will produce "Persian Numbers ۹۱۲۳۴۵۶۷۸۰ اعداد فارسی"
@isTrue
Only show when $variable isset and true, (*6)
@isTrue($variable)
This will be echoed
@endisTrue
@isFalse
Same as @istrue but checks for isset and false, (*7)
@isFalse($variable)
if $variable is False hhis will be echoed
@endisFalse
@isNull
Only show when $variable is null, (*8)
@isNull($variable)
This will be echoed
@endisNull
@isNotNull
Same as @isnull but one shows when $variable is not null, (*9)
@isNotNull($variable)
This will be echoed
@endIsNotNull
@dd
@dd($var)
@dump
@dump($var)
@action
check route action, (*10)
@action('index')
<p>This is rendered only if route's action is Index.</p>
@endaction
or, (*11)
@action('index')
<p>This is rendered only if route's action is Index.</p>
@elseaction('edit')
<p>This is rendered only if route's action is Edit.</p>
@else
<p>This is rendered only if route's action neither is Index nor Edit.</p>
@endaction
@env
check app environment, (*12)
@env('local')
// The application is in the local environment...
@elseenv('testing')
// The application is in the testing environment...
@else
// The application is not in the local or testing environment...
@endenv