. */ namespace App\Libraries; use App\Device; use Illuminate\Support\Facades\Redis; use Illuminate\Support\Facades\Log; use stdClass; class FlexisipConnector { public function getDevices(string $from) { $devices = collect(); try { $content = Redis::hgetall('fs:' . $from); foreach ($content as $key => $contact) { $device = new Device; $device->fromRedisContact($contact); $devices->push($device); } } catch (\Throwable $th) { Log::error('Redis server issue: ' . $th->getMessage()); } return $devices->keyBy('uuid'); } public function deleteDevice(string $from, string $uuid) { try { Redis::hdel('fs:' . $from, '"<' . $uuid . '>"'); } catch (\Throwable $th) { Log::error('Redis server issue: ' . $th->getMessage()); } } }