sukohi / memento
主要为 Laravel 开发,用于使用布尔值检查结果的 PHP 包。
2.0.2
2015-08-05 17:54 UTC
Requires
- php: >=5.4.0
- laravel/framework: ~5.0
This package is not auto-updated.
Last update: 2024-09-14 16:34:41 UTC
README
主要为 Laravel 开发,用于使用布尔值检查结果的 PHP 包。
(适用于 Laravel 5+。 针对 Laravel 4.2)
安装
在 composer.json 中添加此包名
"require": {
"sukohi/memento": "2.*"
}
执行 composer 命令。
composer update
在 app.php 中注册服务提供者
'providers' => array(
...Others...,
Sukohi\Memento\MementoServiceProvider::class,
)
同时别名
'aliases' => array(
...Others...,
'Memento' => Sukohi\Memento\Facades\Memento::class
)
使用方法
$boolean = true;
$memento = \Memento::set($boolean)
->set(function(){
return \Item::where('id', 1)->exists();
});
if($memento->allTrue()) {
echo 'All True';
}
if($memento->allFalse()) {
echo 'All False';
}
if($memento->hasTrue()) {
echo 'Has True';
}
if($memento->hasFalse()) {
echo 'Has False';
}
许可证
此软件包根据 MIT 许可证授权。
版权所有 2015 Sukohi Kuhoh