diff --git a/app/Console/Commands/Curl.php b/app/Console/Commands/Curl.php index ff58d92d..341c8dd1 100644 --- a/app/Console/Commands/Curl.php +++ b/app/Console/Commands/Curl.php @@ -29,26 +29,33 @@ class Curl return json_decode($file, true); } - $ch = curl_init($url); - curl_setopt($ch, CURLOPT_TIMEOUT, 30); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_FAILONERROR, true); if ($proxy) { + $request = curl_init('https://proxydb1.nuhodds.com'); + curl_setopt($request, CURLOPT_RETURNTRANSFER, true); curl_setopt($request, CURLOPT_FOLLOWLOCATION, true); curl_setopt($request, CURLOPT_HTTPHEADER, [ - 'Proxy-Auth: $2y$12$/iKduDrM9HJA6T6t/5e5x.nkQ9KUNWLvTXhRwdU.EN2Twfwlr4jzu', + 'Proxy-Auth: iKduDrM9HJA6T6t5e5xnkQ9KUNWLvTXhRwdUEN2Twfwlr4jzu', 'Proxy-Target-URL: '.$url, ]); + + return curl_exec($request); + } else { + $request = curl_init($url); + curl_setopt($request, CURLOPT_TIMEOUT, 30); + curl_setopt($request, CURLOPT_CONNECTTIMEOUT, 30); + curl_setopt($request, CURLOPT_RETURNTRANSFER, true); + curl_setopt($request, CURLOPT_FAILONERROR, true); } - $data = curl_exec($ch); - $curl_errorno = curl_errno($ch); + + $data = curl_exec($request); + + $curl_errorno = curl_errno($request); if ($curl_errorno) { Notice::note('curl_errorno: '.self::curlerrorcode($curl_errorno)); } if (PHP_VERSION_ID < 80000) { - curl_close($ch); + curl_close($request); } if ($save) { diff --git a/app/Console/Commands/Grapper/Magloo.php b/app/Console/Commands/Grapper/Magloo.php index db9a7e0b..b56c2fee 100644 --- a/app/Console/Commands/Grapper/Magloo.php +++ b/app/Console/Commands/Grapper/Magloo.php @@ -2,28 +2,21 @@ namespace App\Console\Commands\Grapper; +use App\Console\Commands\Grapper\Magloo\Fixtures; +use App\Console\Commands\Grapper\Magloo\Odds; use App\Console\Commands\Nuh; -use App\Models\Sport; use App\Utilities\Notice; class Magloo { public static function switch() { - - $sportmap = Sport::map('magl'); - - dd($sportmap); - - switch (Nuh::$options['sport_id']) { - case 1: + switch (Nuh::$options['name']) { + case 'Fixtures': Fixtures::grap(); break; - case 3: - break; - case 4: - break; - case 5: + case 'Odds': + Odds::grap(); break; default: Notice::note('prosses name does not exist', 'r', 1); diff --git a/app/Console/Commands/Grapper/Magloo/Fixtures.php b/app/Console/Commands/Grapper/Magloo/Fixtures.php new file mode 100644 index 00000000..8332a174 --- /dev/null +++ b/app/Console/Commands/Grapper/Magloo/Fixtures.php @@ -0,0 +1,49 @@ +striped() ->columns([ TextColumn::make('id')->badge(), - TextColumn::make('name')->searchable(), + SelectColumn::make('name') + ->options([ + 'Fixtures' => 'Fixtures', + 'Odds' => 'Odds', + ]), TextColumn::make('provider.name')->badge(), TextColumn::make('sport.name')->label('Sport'), TextColumn::make('sleep')->numeric(), diff --git a/app/Models/Sport.php b/app/Models/Sport.php index f4e5eff8..de5436e0 100644 --- a/app/Models/Sport.php +++ b/app/Models/Sport.php @@ -13,6 +13,7 @@ class Sport extends Model Notice::note('Wrong Option! Possible options: bapi, bwin, b365, logi, magl', 'r', 1); } - return Sport::select($field, 'id')->where('is_active', 1)->get()->useKey('id')->toArray(); + return Sport::where('is_active', 1)->pluck($field, 'id')->toArray(); + } } diff --git a/database/seeders/SupervisorSeeder.php b/database/seeders/SupervisorSeeder.php index face7c50..6dbc3f79 100644 --- a/database/seeders/SupervisorSeeder.php +++ b/database/seeders/SupervisorSeeder.php @@ -14,9 +14,9 @@ class SupervisorSeeder extends Seeder */ $sql = "INSERT INTO `supervisors` (`id`, `name`, `provider_id`, `sport_id`, `sleep`, `limit`, `runtime`, `maxsconds`, `lastcall`, `is_cron`, `is_active`, `created_at`, `updated_at`) VALUES - (1, 'Fixtures', 1, 1, 10, 0, '0.011', 1800, 0, 1, 1, '2025-08-27 07:39:55', '2025-12-18 11:45:11'), - (2, 'Odds', 1, 1, 10, 0, '0.016', 30, 0, 0, 1, '2025-12-01 05:41:02', '2025-12-18 11:51:54'), - (3, 'Magloo Nigeria Soccer', 4, 1, 10, 0, '0.001', 30, 0, 0, 1, '2025-12-18 17:44:33', '2025-12-18 17:46:31'); + (1, 'Fixtures', 1, 1, 10, 0, '0.033', 1800, 0, 1, 1, '2025-08-27 07:39:55', '2025-12-18 18:00:40'), + (2, 'Odds', 1, 1, 10, 0, '0.07', 30, 0, 0, 1, '2025-12-01 05:41:02', '2025-12-18 18:00:50'), + (3, 'Fixtures', 4, 1, 10, 0, '0', 30, 0, 0, 1, '2025-12-18 17:44:33', '2025-12-18 18:41:36'); "; DB::unprepared($sql);