download betfair
This commit is contained in:
1 parent
7c1864a545
commit
2e38a36aec
5 files changed
+82
-10
No files matched your search
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\Event;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
use Illuminate\Support\Number;
|
||||
|
||||
class BetfairExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = Event::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ExportColumn::make('id')
|
||||
->label('TxOdds id'),
|
||||
ExportColumn::make('betsapi_id'),
|
||||
ExportColumn::make('betradar_id'),
|
||||
ExportColumn::make('bet365_id'),
|
||||
ExportColumn::make('starttime'),
|
||||
ExportColumn::make('sport_id'),
|
||||
ExportColumn::make('country_id'),
|
||||
ExportColumn::make('country.name'),
|
||||
ExportColumn::make('competition_group_id')
|
||||
->label('Group id'),
|
||||
ExportColumn::make('competition_group.name')
|
||||
->label('Group'),
|
||||
ExportColumn::make('home_id'),
|
||||
ExportColumn::make('home.name'),
|
||||
ExportColumn::make('away_id'),
|
||||
ExportColumn::make('away.name'),
|
||||
ExportColumn::make('odds_3ways_bf.h3w')
|
||||
->label('1'),
|
||||
ExportColumn::make('odds_3ways_bf.d3w')
|
||||
->label('X'),
|
||||
ExportColumn::make('odds_3ways_bf.a3w')
|
||||
->label('2'),
|
||||
ExportColumn::make('odds_totals_bf.over')
|
||||
->label('Over'),
|
||||
ExportColumn::make('odds_totals_bf.under')
|
||||
->label('Under'),
|
||||
ExportColumn::make('odds_totals_bf.total')
|
||||
->label('Total'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your event export has completed and '.Number::format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' '.Number::format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,6 @@ class KontoSwitcher extends Component
|
||||
$this->clients = Client::where('id', '!=', auth()->user()->client_id)->pluck('name', 'id')->all();
|
||||
}
|
||||
|
||||
public function downloadBetfair() {}
|
||||
|
||||
public function swopClient($client_id)
|
||||
{
|
||||
$providers = Client::where('id', $client_id)->pluck('provider')->first();
|
||||
|
||||
@@ -78,6 +78,11 @@ class Event extends Model
|
||||
return $this->hasMany(Odds3way::class);
|
||||
}
|
||||
|
||||
public function odds_3ways_bf()
|
||||
{
|
||||
return $this->hasMany(Odds3way::class)->where('bookmaker_id', 110);
|
||||
}
|
||||
|
||||
public function odds_3ways_ht()
|
||||
{
|
||||
return $this->hasMany(Odds3wayHt::class);
|
||||
@@ -118,6 +123,11 @@ class Event extends Model
|
||||
return $this->hasMany(OddsTotal::class)->where('active_spread', 1);
|
||||
}
|
||||
|
||||
public function odds_totals_bf()
|
||||
{
|
||||
return $this->hasMany(OddsTotal::class)->where('bookmaker_id', 110);
|
||||
}
|
||||
|
||||
public function odds_totals_q1()
|
||||
{
|
||||
return $this->hasMany(OddsTotalQ1::class)->where('active_spread', 1);
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use Agencetwogether\HooksHelper\HooksHelperPlugin;
|
||||
use App\Filament\Exports\BetfairExporter;
|
||||
use App\Http\Middleware\RecordUserActivity;
|
||||
use Awcodes\LightSwitch\Enums\Alignment;
|
||||
use Awcodes\LightSwitch\LightSwitchPlugin;
|
||||
use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ExportAction;
|
||||
use Filament\Auth\MultiFactor\App\AppAuthentication;
|
||||
use Filament\Auth\MultiFactor\Email\EmailAuthentication;
|
||||
use Filament\Auth\Pages\PasswordReset\RequestPasswordReset;
|
||||
@@ -23,6 +25,7 @@ use Filament\Widgets\AccountWidget;
|
||||
use Filament\Widgets\FilamentInfoWidget;
|
||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||
use Illuminate\Session\Middleware\StartSession;
|
||||
@@ -42,6 +45,15 @@ class AdminPanelProvider extends PanelProvider
|
||||
->middleware([
|
||||
RecordUserActivity::class,
|
||||
])
|
||||
->userMenuItems([
|
||||
ExportAction::make('download_betfair')
|
||||
->columnMapping(false)
|
||||
->exporter(BetfairExporter::class)
|
||||
->label('Download Betfair')
|
||||
->visible(fn (): bool => auth()->user()->hasRole('download_betfair'))
|
||||
->modifyQueryUsing(fn (Builder $query) => $query->where('sport_id', 1))
|
||||
->icon('phosphor-download'),
|
||||
])
|
||||
->path('')
|
||||
->login()
|
||||
->passwordReset(RequestPasswordReset::class)
|
||||
|
||||
@@ -14,15 +14,7 @@
|
||||
{{ $name }}
|
||||
</x-filament::dropdown.list.item>
|
||||
@endforeach
|
||||
|
||||
|
||||
</x-filament::dropdown.list>
|
||||
</x-filament::dropdown>
|
||||
@endif
|
||||
|
||||
@if (auth()->user()->hasRole('download_betfair'))
|
||||
<x-filament::dropdown.list.item wire:click="downloadBetfair()" icon="phosphor-download">
|
||||
Download Betfair
|
||||
</x-filament::dropdown.list.item>
|
||||
@endif
|
||||
</div>
|
||||
Reference in new issue
Block a user