add txodds markets as a resource
This commit is contained in:
1 parent
e14404ec8b
commit
5fa1d02dbd
26 files changed
+921
-55
No files matched your search
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Maintenance\Tasks;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Console\Commands\Xml;
|
||||
use App\Models\TxoddsMarket;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class CallTxoddsMarkets
|
||||
{
|
||||
public static function call()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('TxoddsMarkets', 'b');
|
||||
}
|
||||
|
||||
$url = 'https://xml2.txodds.com/feed/odds_types.php';
|
||||
|
||||
$data = Xml::load($url);
|
||||
|
||||
foreach ($data as $row) {
|
||||
|
||||
$market = [
|
||||
'shortname' => $row->sname,
|
||||
'name' => (string) $row->name,
|
||||
];
|
||||
|
||||
TxoddsMarket::updateOrCreate(['market_id' => (int) $row->ot], $market);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user