mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-24 06:28:27 +01:00
32 lines
655 B
PHP
32 lines
655 B
PHP
<?php
|
|
|
|
namespace App\Helpers;
|
|
|
|
use App\Speedtest;
|
|
use Exception;
|
|
|
|
class BackupHelper {
|
|
public static function backup()
|
|
{
|
|
$data = Speedtest::get();
|
|
|
|
return $data;
|
|
}
|
|
|
|
public static function restore($array)
|
|
{
|
|
foreach($array as $test) {
|
|
try {
|
|
$st = Speedtest::create([
|
|
'ping' => $test['ping'],
|
|
'download' => $test['download'],
|
|
'upload' => $test['upload'],
|
|
'created_at' => $test['created_at'],
|
|
]);
|
|
} catch(Exception $e) {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
}
|