How to leverage the glob method of Filesystem class with StorageFacade?

妖精的绣舞 提交于 2019-12-04 22:51:01

I think you cannot run glob here, but you could get all files and then filter them, for example:

$files = array_filter(Storage::disk('local')->files(), function ($file)
{
    return preg_match('/_(.*)\.blade\.php$/U', $file);
});

Of course you need to decide to use files or allFiles (recursively) depending on your needs. Probably it's not the best solution if you have thousands of files but if you don't it should be enough

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!