Restore shifts
This commit is contained in:
miroman-afk
2022-01-10 14:42:35 +03:00
parent 0209970fe1
commit cf1e228f26
5 changed files with 81 additions and 3 deletions

View File

@@ -20,8 +20,23 @@ class POSTRestoreShift extends HRCCommand implements HRCCommandInterface {
protected $signature = 'postrestoreshift';
public function command($input, $output = null) {
function dirDel($dir) {
$d = opendir($dir);
while (($entry = readdir($d)) !== false) {
if ($entry != "." && $entry != "..") {
if (is_dir($dir . "/" . $entry)) {
dirDel($dir . "/" . $entry);
} else {
unlink($dir . "/" . $entry);
}
}
}
closedir($d);
rmdir($dir);
}
$shift_id = 4;
$cache_dir = __DIR__ . "\\..\\..\\..\\Cache\\";
dirDel($cache_dir);
$terminal_updates_old = TerminalUpdate::where('method', '=', 'online')->get();
foreach ($terminal_updates_old as $key => $terminal_online) {
$old_date = date_create($terminal_online['next_at']);