add element icons in monitor

This commit is contained in:
salam committed 2026-03-06 10:19:13 +01:00
1 parent 84c8490de3
commit 4b221869ff
7 files changed
+103 -3

No files matched your search

+4
View File
@@ -4,6 +4,7 @@ namespace App\Console\Commands\Grapper;
use App\Console\Commands\Grapper\Betsapi\Bet365;
use App\Console\Commands\Grapper\Betsapi\Bwin;
use App\Console\Commands\Grapper\Betsapi\ElementIcons;
use App\Console\Commands\Grapper\Betsapi\Fixtures;
use App\Console\Commands\Grapper\Betsapi\Odds;
use App\Console\Commands\Grapper\Betsapi\Willhill;
@@ -35,6 +36,9 @@ class Betsapi
case 'Bet365':
Bet365::grap();
break;
case 'Element Icons':
ElementIcons::grap();
break;
default:
Notice::note('prosses name does not exist', 'r', 1);
break;
@@ -0,0 +1,54 @@
<?php
namespace App\Console\Commands\Grapper\Betsapi;
use App\Console\Commands\Curl;
use App\Console\Commands\Nuh;
use App\Models\Element;
use App\Models\ElementProvider;
use App\Utilities\Notice;
class ElementIcons
{
public static function grap()
{
$debug = Nuh::$options['d'] ?? 0;
$min_id = 1;
while ($min_id > 0) {
if ($min_id == 1) {
$url = 'https://api.b365api.com/v3/team?token='.config('env.betsapi_token').'&sport_id=1&is_esports=1';
} else {
$url = 'https://api.b365api.com/v3/team?token='.config('env.betsapi_token').'&sport_id=1&is_esports=1&max_id='.$min_id;
}
$data = Curl::load($url);
if (! $data['success']) {
break;
}
$min_id = $data['pager']['min_id'];
if ($debug) {
Notice::note("MinId: $min_id");
}
foreach ($data['results'] as $value) {
if (! isset($value['is_esports']) && $value['image_id'] > 0 && $value['cc'] != '') {
$res = ElementProvider::where('provider_id', 2)->where('provider_element_id', (int) $value['id'])->first();
if ($res) {
if ($debug) {
Notice::note($value, 'b');
}
Element::where('id', $res->element_id)->update(['betsapi_image_id' => $value['image_id']]);
}
}
}
}
}
}
@@ -4,8 +4,8 @@ namespace App\Filament\Clusters\Grapper\Resources\Supervisors;
use App\Filament\Clusters\Grapper\GrapperCluster;
use App\Filament\Clusters\Grapper\Resources\Supervisors\Pages\ListSupervisors;
use App\Filament\Clusters\Grapper\Resources\Supervisors\Schemas\SupervisorForm;
use App\Filament\Clusters\Grapper\Resources\Supervisors\Tables\SupervisorsTable;
use App\Filament\Resources\Supervisors\Schemas\SupervisorForm;
use App\Models\Supervisor;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
@@ -71,6 +71,7 @@ class SupervisorsTable
'Bwin' => 'Bwin',
'Bet365' => 'Bet365',
'Betfair' => 'Betfair',
'Element Icons' => 'Element Icons',
];
case 7:
/**
@@ -14,6 +14,7 @@ return new class extends Migration
Schema::create('elements', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->integer('betsapi_image_id')->index()->nullable()->default(0);
$table->integer('sport_id')->index()->references('id')->on('sports');
$table->integer('country_id')->default(0)->nullable()->index()->references('id')->on('countries');
$table->timestamps();
@@ -1,17 +1,33 @@
@if ($record->event_bookmaker?->is_swopped)
<div {{ $getExtraAttributeBag() }} class="flex flex-col gap-2 w-full">
<div class="flex flex-1 gap-1">
<div class="flex flex-1 gap-1 items-center">
@if ($record->home->betsapi_image_id)
<img src="https://assets.b365api.com/images/team/m/{{ $record->home->betsapi_image_id }}.png"
class="h-4">
@endif
<div>{{ $record->away?->name }}</div>
<div>-</div>
@if ($record->away->betsapi_image_id)
<img src="https://assets.b365api.com/images/team/m/{{ $record->away->betsapi_image_id }}.png"
class="h-4">
@endif
<div>{{ $record->home?->name }}</div>
</div>
<div class="text-gray-600 dark:!text-gray-400 text-xs">{{ $record->group?->name }}</div>
</div>
@else
<div {{ $getExtraAttributeBag() }} class="flex flex-col gap-2 w-full">
<div class="flex flex-1 gap-1">
<div class="flex flex-1 gap-1 items-center">
@if ($record->home->betsapi_image_id)
<img src="https://assets.b365api.com/images/team/m/{{ $record->home->betsapi_image_id }}.png"
class="h-4">
@endif
<div>{{ $record->home?->name }}</div>
<div>-</div>
@if ($record->away->betsapi_image_id)
<img src="https://assets.b365api.com/images/team/m/{{ $record->away->betsapi_image_id }}.png"
class="h-4">
@endif
<div>{{ $record->away?->name }}</div>
</div>
<div class="text-gray-600 dark:!text-gray-400 text-xs">{{ $record->group?->name }}</div>
@@ -61,6 +61,30 @@
{{ $record->event_bookmaker?->event_id }}
</div>
@endif
@if ($record?->home_id)
<div>Home Id</div>
<div>
{{ $record->home_id }}
</div>
@endif
@if ($record?->away_id)
<div>Away Id</div>
<div>
{{ $record->away_id }}
</div>
@endif
@if ($record?->home->betsapi_image_id)
<div>Home Image: </div>
<div>
{{ $record->home->betsapi_image_id }}
</div>
@endif
@if ($record?->away->betsapi_image_id)
<div>Away Image: </div>
<div>
{{ $record->away->betsapi_image_id }}
</div>
@endif
</div>
</div>