younesi / blade-directives
Magic Directives for Blade
1.0.0
2018-02-27 20:41 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-07-06 09:36:22 UTC
README
Laravel Custom Blade directives for Laravel Applications.
See https://laravel.com/docs/blade
Installation:
$ composer require younesi/blade-directives
Available directives:
@persianNum
convert latin numbers to their persian equvalent
@persianNum('Persian Numbers 9123456780 اعداد فارسی')
//will produce "Persian Numbers ۹۱۲۳۴۵۶۷۸۰ اعداد فارسی"
@isTrue
Only show when $variable isset and true
@isTrue($variable)
This will be echoed
@endisTrue
@isFalse
Same as @istrue but checks for isset and false
@isFalse($variable)
if $variable is False hhis will be echoed
@endisFalse
@isNull
Only show when $variable is null
@isNull($variable)
This will be echoed
@endisNull
@isNotNull
Same as @isnull but one shows when $variable is not null
@isNotNull($variable)
This will be echoed
@endIsNotNull
@dd
@dd($var)
@dump
@dump($var)
@action
check route action
@action('index')
<p>This is rendered only if route's action is Index.</p>
@endaction
or
@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
@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