我正在尝试使用以下代码过滤缓存数据
$Categories = \Cache::rememberForever('Categories', function() {
return \App\Models\Skill\Category_Model::all();
});
$Category = $Categories::where("CategoryID", "=", $id)->first();
错误详情 :
非静态方法 Illuminate\Support\Collection::where() 不应被静态调用,假设 $this 来自不兼容的上下文
我错过了什么吗?
我的意思是,过滤缓存对象中数据的最快方法是什么。缓存对象是一个模型。Categories 数组包含模型的集合,其中包含 categoryID ID。我想根据 CategoryID 过滤数据