你奈西 / blade-directives
Blade 的魔法指令
1.0.0
2018-02-27 20:41 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-29 05:49:17 UTC
README
Laravel 应用程序的 Laravel 自定义 Blade 指令。
见 https://laravel.net.cn/docs/blade
安装
$ composer require younesi/blade-directives
可用指令
@persianNum
将拉丁数字转换为它们的波斯等效数
@persianNum('Persian Numbers 9123456780 اعداد فارسی')
//will produce "Persian Numbers ۹۱۲۳۴۵۶۷۸۰ اعداد فارسی"
@isTrue
仅当 $variable 已设置且为 true 时显示
@isTrue($variable)
This will be echoed
@endisTrue
@isFalse
与 @isTrue 相同,但检查 isset 和 false
@isFalse($variable)
if $variable is False hhis will be echoed
@endisFalse
@isNull
仅当 $variable 为 null 时显示
@isNull($variable)
This will be echoed
@endisNull
@isNotNull
与 @isNull 相同,但 $variable 不为 null 时显示
@isNotNull($variable)
This will be echoed
@endIsNotNull
@dd
@dd($var)
@dump
@dump($var)
@action
检查路由操作
@action('index')
<p>This is rendered only if route's action is Index.</p>
@endaction
或
@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
检查应用程序环境
@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