storage = Storage::disk('local'); } public function all() { $searchers = []; $files = $this->storage->files('searchers'); foreach ($files as $file) { if (pathinfo($file, PATHINFO_EXTENSION) === 'json') { $name = pathinfo($file, PATHINFO_FILENAME); $result = explode('_', $name); if (count($result) === 2) { $searchers[$name] = [ 'id' => $result[0], 'name' => $result[1], ]; } } } return $searchers; } public function has($id) { return $this->storage->exists("searchers/$id.json"); } public function get($id) { $contents = $this->storage->get("searchers/$id.json"); return json_decode($contents, true); } }