cleanup comparatore

This commit is contained in:
salam committed 2025-12-12 07:35:03 +01:00
1 parent 2052ccdd77
commit adaec7b3dc
20 files changed
+97 -204

No files matched your search

@@ -9,9 +9,6 @@ use App\Utilities\Notice;
class TxSwitch class TxSwitch
{ {
/**
* https://docs.guzzlephp.org/en/latest/
*/
public static function switch() public static function switch()
{ {
if (NuhBash::$options['sport_id'] == 1) { if (NuhBash::$options['sport_id'] == 1) {
@@ -14,6 +14,7 @@ class BettypesTable
public static function configure(Table $table): Table public static function configure(Table $table): Table
{ {
return $table return $table
->striped()
->columns([ ->columns([
TextColumn::make('bettype_id') TextColumn::make('bettype_id')
->width('1rem') ->width('1rem')
@@ -15,6 +15,7 @@ class BookmakersTable
public static function configure(Table $table): Table public static function configure(Table $table): Table
{ {
return $table return $table
->striped()
->columns([ ->columns([
TextColumn::make('name') TextColumn::make('name')
->searchable(), ->searchable(),
@@ -15,6 +15,7 @@ class ClientsTable
public static function configure(Table $table): Table public static function configure(Table $table): Table
{ {
return $table return $table
->striped()
->columns([ ->columns([
TextColumn::make('name'), TextColumn::make('name'),
TextColumn::make('bookmaker') TextColumn::make('bookmaker')
@@ -56,6 +56,7 @@ class CountryResource extends Resource
public static function table(Table $table): Table public static function table(Table $table): Table
{ {
return $table return $table
->striped()
->recordTitleAttribute('name') ->recordTitleAttribute('name')
->columns([ ->columns([
TextColumn::make('id')->searchable(), TextColumn::make('id')->searchable(),
@@ -62,7 +62,9 @@ class EventResource extends Resource
public static function getEloquentQuery(): Builder public static function getEloquentQuery(): Builder
{ {
return parent::getEloquentQuery()->withoutGlobalScopes()->with('odds_3way'); return parent::getEloquentQuery()
// return parent::getEloquentQuery()->withoutGlobalScopes()->with('odds_3way')->where('starttime', '>', Carbon::now()); ->where('starttime', '>', Carbon::now())
->where('sport_id', auth()->user()->sport_id)
->withoutGlobalScopes()->with('odds_3way');
} }
} }
@@ -19,6 +19,7 @@ class EventsTable
{ {
return $table return $table
->poll('10s') ->poll('10s')
->striped()
->columns([ ->columns([
IconColumn::make('sport.icon') IconColumn::make('sport.icon')
->label('') ->label('')
@@ -11,6 +11,7 @@ class ProvidersTable
public static function configure(Table $table): Table public static function configure(Table $table): Table
{ {
return $table return $table
->striped()
->columns([ ->columns([
TextColumn::make('id'), TextColumn::make('id'),
TextColumn::make('name'), TextColumn::make('name'),
@@ -44,6 +44,7 @@ class SportResource extends Resource
public static function table(Table $table): Table public static function table(Table $table): Table
{ {
return $table return $table
->striped()
->columns([ ->columns([
IconColumn::make('icon') IconColumn::make('icon')
->label('') ->label('')
@@ -14,6 +14,7 @@ class SupervisorsTable
public static function configure(Table $table): Table public static function configure(Table $table): Table
{ {
return $table return $table
->striped()
->columns([ ->columns([
TextColumn::make('id')->badge(), TextColumn::make('id')->badge(),
TextColumn::make('name')->searchable(), TextColumn::make('name')->searchable(),
-10
View File
@@ -1,10 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AlarmSetting extends Model
{
//
}
-17
View File
@@ -1,17 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Comparatore extends Model
{
protected $fillable = [
'match_id',
'sport_id',
'bookmaker_id',
'pushmode',
'hash',
'fdata',
];
}
-10
View File
@@ -1,10 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ComparatoreSetting extends Model
{
//
}
-25
View File
@@ -1,25 +0,0 @@
<?php
namespace App\Utilities;
use Exception;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
class Guzzle
{
public static function load($url, $debug = 0)
{
BetsapiCounter::count($debug);
if ($debug) {
Notice::note($url, 'g');
}
$data = Http::retry(3, 2, function (Exception $exception, PendingRequest $request) {
return $exception instanceof ConnectionException;
})->get($url);
return json_decode($data, true);
}
}
-40
View File
@@ -1,40 +0,0 @@
<?php
namespace App\Utilities;
use App\Models\Comparatore;
use App\Models\EventCustomer;
class NuhHash
{
public static function md5($data)
{
if (is_array($data)) {
$data = serialize($data);
}
return hash('md5', $data, false);
}
public static function comparatore_all($options)
{
$res = Comparatore::select('event_id', 'hash', 'updated_at')->where('sport_id', $options['sport_id'])->where('customer_id', $options['customer_id'])->get();
$_hash = [];
foreach ($res as $value) {
$event_id = $value['event_id'];
$_hash[$event_id] = ['hash' => $value['hash'], 'timestamp' => strtotime($value['updated_at'])];
}
return $_hash;
}
public static function load_event($options)
{
$res = EventCustomer::select('calculation_hash')->where('event_id', $options['event_id'])->where('customer_id', $options['customer_id'])->first();
if ($res) {
return $res->calculation_hash;
}
return false;
}
}
@@ -18,6 +18,7 @@ return new class extends Migration
$table->timestamp('email_verified_at')->nullable(); $table->timestamp('email_verified_at')->nullable();
$table->string('password'); $table->string('password');
$table->integer('client_id')->index(); $table->integer('client_id')->index();
$table->integer('sport_id')->index();
$table->boolean('super_admin')->default(false); $table->boolean('super_admin')->default(false);
$table->text('app_authentication_secret')->nullable(); $table->text('app_authentication_secret')->nullable();
@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('comparatores', function (Blueprint $table) {
$table->id();
$table->integer('match_id');
$table->integer('sport_id')->default(0);
$table->integer('bookmaker_id')->default(0);
$table->string('pushmode')->nullable();
$table->string('hash')->nullable();
$table->longText('fdata')->nullable()->default('text');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('comparatores');
}
};
@@ -1,30 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('alarm_settings', function (Blueprint $table) {
$table->id();
$table->foreignId('client_id')->constrained()->cascadeOnDelete();
$table->integer('sport_id')->default(0);
$table->integer('bookmaker_id')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('alarm_settings');
}
};
@@ -1,30 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('comparatore_settings', function (Blueprint $table) {
$table->id();
$table->foreignId('client_id')->constrained()->cascadeOnDelete();
$table->integer('sport_id')->default(0);
$table->integer('bettype_id')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('comparatore_settings');
}
};
@@ -1,4 +1,86 @@
<div class="flex"> <x-filament::dropdown>
<x-slot name="trigger">
<template x-if="theme === 'light'">
<x-filament::button size="lg" icon="icon-soccerball" color="white" icon-size="md" x-ref="trigger">
Soccer
</x-filament::button>
</template>
<template x-if="theme === 'dark'">
<x-filament::icon-button size="lg" color="white" icon="heroicon-o-moon" icon-size="md"
icon-position="before" x-ref="trigger" />
</template>
<template x-if="theme === 'system'">
<x-filament::icon-button size="lg" color="white" icon="heroicon-o-computer-desktop" icon-size="md"
icon-position="before" x-ref="trigger" />
</template>
</x-slot>
<x-filament::dropdown.list class="flex flex-col gap-y-1" x-data="{ theme: null }" x-init="$watch('theme', () => {
$dispatch('theme-changed', theme)
})
theme = localStorage.getItem('theme') || 'system';">
<x-filament::dropdown.list.item icon="heroicon-o-sun" icon-size="md" icon-color="white" icon-position="before"
class="font-medium" x-on:click="(theme = 'light') && close()"
x-bind:class="theme === 'light'
?
'bg-gray-50 text-primary-500 dark:bg-white/5 dark:text-primary-400' :
'text-gray-400 hover:text-gray-500 focus-visible:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400 dark:focus-visible:text-gray-400'">
<span
x-bind:class="theme === 'light'
?
'text-primary-500 dark:text-primary-400' :
'text-gray-950 dark:text-white'">
{{ __('Light') }}
</span>
</x-filament::dropdown.list.item>
<x-filament::dropdown.list.item icon="heroicon-o-moon" icon-size="md" icon-color="white" icon-position="before"
class="font-medium" x-on:click="(theme = 'dark') && close()"
x-bind:class="theme === 'dark'
?
'bg-gray-50 text-primary-500 dark:bg-white/5 dark:text-primary-400' :
'text-gray-400 hover:text-gray-500 focus-visible:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400 dark:focus-visible:text-gray-400'">
<span
x-bind:class="theme === 'dark'
?
'text-primary-500 dark:text-primary-400' :
'text-gray-950 dark:text-white'">
{{ __('Dark') }}
</span>
</x-filament::dropdown.list.item>
<x-filament::dropdown.list.item icon="heroicon-o-computer-desktop" icon-size="md" icon-color="white"
icon-position="before" class="font-medium" x-on:click="(theme = 'system') && close()"
x-bind:class="theme === 'system'
?
'bg-gray-50 text-primary-500 dark:bg-white/5 dark:text-primary-400' :
'text-gray-400 hover:text-gray-500 focus-visible:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400 dark:focus-visible:text-gray-400'">
<span
x-bind:class="theme === 'system'
?
'text-primary-500 dark:text-primary-400' :
'text-gray-950 dark:text-white'">
{{ __('System') }}
</span>
</x-filament::dropdown.list.item>
</x-filament::dropdown.list>
</x-filament::dropdown>
{{-- <x-filament::input.wrapper>
<x-filament::input.select wire:model="status">
<option value="1">Soccer</option>
<option value="2">Basketball</option>
<option value="3">Ice Hockey</option>
<option value="5">Tennis</option>
</x-filament::input.select>
</x-filament::input.wrapper>
--}}
{{-- <x-filament::input.wrapper prefix-icon="icon-soccerball">
<x-filament::input.select wire:model="status">
<option value="draft">Soccer</option>
<option value="reviewing">Reviewing</option>
<option value="published">Published</option>
</x-filament::input.select>
</x-filament::input.wrapper> --}}
{{-- <div class="flex">
<x-filament::button icon="icon-soccerball"> <x-filament::button icon="icon-soccerball">
Soccer Soccer
</x-filament::button> </x-filament::button>
@@ -11,4 +93,4 @@
<x-filament::button icon="icon-tennisball" color="gray"> <x-filament::button icon="icon-tennisball" color="gray">
Tennis Tennis
</x-filament::button> </x-filament::button>
</div> </div> --}}