本文整理汇总了PHP中Illuminate\Support\Facades\Cache::getStore方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::getStore方法的具体用法?PHP Cache::getStore怎么用?PHP Cache::getStore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Cache
的用法示例。
在下文中一共展示了Cache::getStore方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restore
public function restore()
{
//soft delete undo's
parent::restore();
if (Cache::getStore() instanceof TaggableStore) {
Cache::tags(Config::get('entrust.role_user_table'))->flush();
}
}
示例2: restore
public function restore()
{
//soft delete undo's
if (!parent::restore()) {
return false;
}
if (Cache::getStore() instanceof TaggableStore) {
Cache::tags(Config::get('entrust.permission_role_table'))->flush();
}
return true;
}
示例3: bootEntrustUserTrait
/**
* Boot the user model
* Attach event listener to remove the many-to-many records when trying to delete
* Will NOT delete any records if the user model uses soft deletes.
*
* @return void|bool
*/
public static function bootEntrustUserTrait()
{
$flushCache = function () {
if (Cache::getStore() instanceof TaggableStore) {
Cache::tags(Config::get('entrust.permission_role_table'))->flush();
}
};
static::restored($flushCache);
static::deleted($flushCache);
static::saved($flushCache);
static::deleting(function ($user) {
if (!method_exists(Config::get('auth.model'), 'bootSoftDeletes')) {
$user->roles()->sync([]);
}
return true;
});
}
示例4: restore
/**
* Flush the cached roles when new cache is restored
* restore = undo soft deleting
*/
public function restore()
{
parent::restore();
if (Cache::getStore() instanceof TaggableStore) {
Cache::tags($this->cacheName)->flush();
}
}
示例5: savePermissions
/**
* Save the inputted permissions.
*
* @param mixed $inputPermissions
*
* @return void
*/
public function savePermissions($inputPermissions)
{
if (!empty($inputPermissions)) {
$this->perms()->sync($inputPermissions);
} else {
$this->perms()->detach();
}
if (Cache::getStore() instanceof TaggableStore) {
Cache::tags(Config::get('entrust.permission_role_table'))->flush();
}
}
示例6: isTagCacheAllowed
/**
* Check if tag caching is allowed
*
* @return bool
*/
public function isTagCacheAllowed()
{
return Cache::getStore() instanceof TaggableStore;
}