wip grapper

This commit is contained in:
salam committed 2026-06-13 19:19:53 +02:00
1 parent 417ba0707d
commit b01d336a05
17 files changed
+9883 -177

No files matched your search

+30 -2
View File
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper;
use App\Console\Commands\Grapper\Sofascore\Events;
use App\Console\Commands\Grapper\Sofascore\Special;
use App\Console\Commands\Grapper\Sofascore\Tournament;
use App\Console\Commands\Nuh;
use App\Models\SofaScoreCategorie;
@@ -10,13 +11,14 @@ use App\Models\SofaScoreDay;
use App\Models\SofaScoreDayTournament;
use App\Models\SofaScoreTournament;
use App\Utilities\Notice;
use DateTime;
use Illuminate\Support\Carbon;
class Sofascore
{
public static $auth_header = [];
public static $base_url = '';
public static $_days = [];
public static $sport = [1];
public static function switch()
@@ -31,6 +33,23 @@ class Sofascore
Notice::note('Table SofaScoreDay, SofaScoreDayTournament, SofaScoreTournament, SofaScoreCategorie truncated!', 'b', 1);
}
if (Nuh::$options['t']) {
self::$_days[] = Carbon::now()->format('Y-m-d');
} else if (Nuh::$options['day']) {
if (self::validateDate(Nuh::$options['day'])) {
self::$_days[] = Nuh::$options['day'];
} else {
Notice::note('date not valid ' . Nuh::$options['day'], 'r', 1);
}
} else if (Nuh::$options['days']) {
$to = Carbon::now()->subDays(Nuh::$options['days']);
$from = Carbon::now()->subDay();
while ($from >= $to) {
self::$_days[] = $from->format('Y-m-d');
$from->subDay();
}
}
if ($debug) {
Notice::note(Nuh::$options['sport'] . ' ' . Nuh::$options['name'], 'b');
}
@@ -42,10 +61,19 @@ class Sofascore
case 'EVENTS':
Events::load();
break;
case 'SPECIAL':
Special::load();
break;
default:
// code...
break;
}
}
public static function validateDate($date, $format = 'Y-m-d')
{
$d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date;
}
}