provider, clients migration & resource
This commit is contained in:
1 parent
ab44b05fa3
commit
cbe68f78be
56 files changed
+721
-289
No files matched your search
@@ -17,6 +17,7 @@ class BookmakerForm
|
||||
TextInput::make('icon')
|
||||
->required(),
|
||||
FileUpload::make('image')
|
||||
->preserveFilenames()
|
||||
->default(null),
|
||||
TextInput::make('baid')
|
||||
->numeric()
|
||||
|
||||
@@ -26,7 +26,9 @@ class BookmakersTable
|
||||
->icon(function ($record): string {
|
||||
return 'bkm-'.$record->icon;
|
||||
}),
|
||||
ImageColumn::make('image'),
|
||||
ImageColumn::make('image')
|
||||
->imageHeight(30)
|
||||
->imageWidth(110),
|
||||
TextColumn::make('baid')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace App\Filament\Resources\Clients;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Clients\Pages\CreateClient;
|
||||
use App\Filament\Resources\Clients\Pages\EditClient;
|
||||
use App\Filament\Resources\Clients\Pages\ListClients;
|
||||
use App\Filament\Resources\Clients\Schemas\ClientForm;
|
||||
use App\Filament\Resources\Clients\Tables\ClientsTable;
|
||||
@@ -37,19 +35,10 @@ class ClientResource extends Resource
|
||||
return ClientsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListClients::route('/'),
|
||||
'create' => CreateClient::route('/create'),
|
||||
'edit' => EditClient::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Clients\RelationManagers;
|
||||
|
||||
use App\Filament\Resources\Clients\ClientResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class BookmakerRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'bookmaker';
|
||||
|
||||
protected static ?string $relatedResource = ClientResource::class;
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->headerActions([
|
||||
CreateAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace App\Filament\Resources\Clients\Schemas;
|
||||
|
||||
use App\Models\Bookmaker;
|
||||
use App\Models\Sport;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
@@ -13,10 +16,18 @@ class ClientForm
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
TextInput::make('icon')
|
||||
->default(null),
|
||||
TextInput::make('homepage')
|
||||
->default(null),
|
||||
Select::make('bookmaker')
|
||||
->options(Bookmaker::query()->pluck('name', 'id'))
|
||||
->multiple()
|
||||
->preload()
|
||||
->searchable(),
|
||||
Select::make('sport')
|
||||
->options(Sport::query()->pluck('name', 'id'))
|
||||
->multiple()
|
||||
->preload()
|
||||
->searchable(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources\Clients\Tables;
|
||||
|
||||
use App\Models\Bookmaker;
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
@@ -14,12 +16,14 @@ class ClientsTable
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
TextColumn::make('icon')
|
||||
->searchable(),
|
||||
TextColumn::make('homepage')
|
||||
->searchable(),
|
||||
TextColumn::make('name'),
|
||||
TextColumn::make('bookmaker')
|
||||
->badge()
|
||||
->formatStateUsing(fn (string $state): string => Bookmaker::where('id', $state)->pluck('name')->first()),
|
||||
TextColumn::make('sport')
|
||||
->badge()
|
||||
->color('secondary')
|
||||
->formatStateUsing(fn (string $state): string => Sport::where('id', $state)->pluck('name')->first()),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
@@ -29,9 +33,6 @@ class ClientsTable
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Providers\Pages;
|
||||
|
||||
use App\Filament\Resources\Providers\ProviderResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateProvider extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ProviderResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Providers\Pages;
|
||||
|
||||
use App\Filament\Resources\Providers\ProviderResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditProvider extends EditRecord
|
||||
{
|
||||
protected static string $resource = ProviderResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Providers\Pages;
|
||||
|
||||
use App\Filament\Resources\Providers\ProviderResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListProviders extends ListRecords
|
||||
{
|
||||
protected static string $resource = ProviderResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Providers;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Providers\Pages\ListProviders;
|
||||
use App\Filament\Resources\Providers\Schemas\ProviderForm;
|
||||
use App\Filament\Resources\Providers\Tables\ProvidersTable;
|
||||
use App\Models\Provider;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class ProviderResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Provider::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-arrow-down-up';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $navigationLabel = 'Provider';
|
||||
|
||||
protected static ?string $pluralLabel = 'Providers';
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Administration';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return ProviderForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return ProvidersTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListProviders::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Providers\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class ProviderForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Providers\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ProvidersTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('name'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -19,10 +19,13 @@ class UserForm
|
||||
->label('Email address')
|
||||
->email()
|
||||
->required(),
|
||||
DateTimePicker::make('email_verified_at'),
|
||||
TextInput::make('password')
|
||||
->password()
|
||||
->required(),
|
||||
// DateTimePicker::make('email_verified_at'),
|
||||
// TextInput::make('password')
|
||||
// ->password()
|
||||
// ->required(),
|
||||
Select::make('client_id')
|
||||
->relationship('client', 'name')
|
||||
->preload(),
|
||||
Select::make('roles')
|
||||
->relationship('roles', 'name')
|
||||
->multiple()
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Filament\Resources\Users\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
@@ -19,9 +17,7 @@ class UsersTable
|
||||
TextColumn::make('email')
|
||||
->label('Email address')
|
||||
->searchable(),
|
||||
TextColumn::make('email_verified_at')
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
TextColumn::make('client.name')->badge(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
@@ -30,19 +26,12 @@ class UsersTable
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('avatar_url')
|
||||
->searchable(),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace App\Filament\Resources\Users;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Users\Pages\CreateUser;
|
||||
use App\Filament\Resources\Users\Pages\EditUser;
|
||||
use App\Filament\Resources\Users\Pages\ListUsers;
|
||||
use App\Filament\Resources\Users\Schemas\UserForm;
|
||||
use App\Filament\Resources\Users\Tables\UsersTable;
|
||||
@@ -50,8 +48,6 @@ class UserResource extends Resource
|
||||
{
|
||||
return [
|
||||
'index' => ListUsers::route('/'),
|
||||
'create' => CreateUser::route('/create'),
|
||||
'edit' => EditUser::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ class Bookmaker extends Model
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'icon',
|
||||
'image',
|
||||
'baid',
|
||||
'txid',
|
||||
'txso',
|
||||
|
||||
+9
-13
@@ -6,19 +6,15 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Client extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'homepage',
|
||||
protected $casts = [
|
||||
'bookmaker' => 'json',
|
||||
'sport' => 'json',
|
||||
];
|
||||
|
||||
public function client_sports()
|
||||
{
|
||||
return $this->hasMany(ClientSports::class);
|
||||
}
|
||||
|
||||
public function client_bookmaker()
|
||||
{
|
||||
return $this->hasMany(ClientBookmaker::class);
|
||||
}
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'homepage',
|
||||
'bookmaker',
|
||||
'sport',
|
||||
];
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ClientBookmaker extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'client_id',
|
||||
'bookmaker_id',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
public function client()
|
||||
{
|
||||
return $this->belongsTo(Client::class);
|
||||
}
|
||||
|
||||
public function bookmaker()
|
||||
{
|
||||
return $this->belongsTo(Bookmaker::class);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ClientSport extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'client_id',
|
||||
'sport_id',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
public function client()
|
||||
{
|
||||
return $this->belongsTo(Client::class);
|
||||
}
|
||||
|
||||
public function sport()
|
||||
{
|
||||
return $this->belongsTo(Sport::class);
|
||||
}
|
||||
}
|
||||
+12
-10
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\EnumMatchpart;
|
||||
use App\Enums\EnumSuspended;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Odds2way extends Model
|
||||
@@ -16,38 +14,42 @@ class Odds2way extends Model
|
||||
'sport_id',
|
||||
'matchpart_id',
|
||||
'bookmaker_id',
|
||||
'bookmaker',
|
||||
'suspended',
|
||||
'oddshash',
|
||||
'provider_id',
|
||||
'home',
|
||||
'away',
|
||||
'margin',
|
||||
'flag',
|
||||
'check',
|
||||
'add_time',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'suspended' => EnumSuspended::class,
|
||||
'matchpart_id' => EnumMatchpart::class,
|
||||
];
|
||||
|
||||
public function sport()
|
||||
{
|
||||
return $this->belongsTo(Sport::class, 'sport_id');
|
||||
return $this->belongsTo(Sport::class);
|
||||
}
|
||||
|
||||
public function bookmaker()
|
||||
{
|
||||
return $this->belongsTo(Bookmaker::class, 'bookmaker_id');
|
||||
return $this->belongsTo(Bookmaker::class);
|
||||
}
|
||||
|
||||
public function matchpart()
|
||||
{
|
||||
return $this->belongsTo(Matchpart::class, 'matchpart_id');
|
||||
return $this->belongsTo(Matchpart::class);
|
||||
}
|
||||
|
||||
public function event()
|
||||
{
|
||||
return $this->belongsTo(Event::class, 'event_id');
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return $this->belongsTo(Provider::class);
|
||||
}
|
||||
}
|
||||
+12
-10
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\EnumMatchpart;
|
||||
use App\Enums\EnumSuspended;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Odds3way extends Model
|
||||
@@ -16,39 +14,43 @@ class Odds3way extends Model
|
||||
'sport_id',
|
||||
'matchpart_id',
|
||||
'bookmaker_id',
|
||||
'bookmaker',
|
||||
'suspended',
|
||||
'oddshash',
|
||||
'provider_id',
|
||||
'home',
|
||||
'draw',
|
||||
'away',
|
||||
'margin',
|
||||
'flag',
|
||||
'check',
|
||||
'add_time',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'suspended' => EnumSuspended::class,
|
||||
'matchpart_id' => EnumMatchpart::class,
|
||||
];
|
||||
|
||||
public function sport()
|
||||
{
|
||||
return $this->belongsTo(Sport::class, 'sport_id');
|
||||
return $this->belongsTo(Sport::class);
|
||||
}
|
||||
|
||||
public function bookmaker()
|
||||
{
|
||||
return $this->belongsTo(Bookmaker::class, 'bookmaker_id');
|
||||
return $this->belongsTo(Bookmaker::class);
|
||||
}
|
||||
|
||||
public function matchpart()
|
||||
{
|
||||
return $this->belongsTo(Matchpart::class, 'matchpart_id');
|
||||
return $this->belongsTo(Matchpart::class);
|
||||
}
|
||||
|
||||
public function event()
|
||||
{
|
||||
return $this->belongsTo(Event::class, 'event_id');
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return $this->belongsTo(Provider::class);
|
||||
}
|
||||
}
|
||||
+12
-9
@@ -3,7 +3,6 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\EnumMatchpart;
|
||||
use App\Enums\EnumSuspended;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OddsDnb extends Model
|
||||
@@ -16,38 +15,42 @@ class OddsDnb extends Model
|
||||
'sport_id',
|
||||
'matchpart_id',
|
||||
'bookmaker_id',
|
||||
'bookmaker',
|
||||
'suspended',
|
||||
'oddshash',
|
||||
'provider_id',
|
||||
'dnb1',
|
||||
'dnb2',
|
||||
'margin',
|
||||
'flag',
|
||||
'check',
|
||||
'add_time',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'suspended' => EnumSuspended::class,
|
||||
'matchpart_id' => EnumMatchpart::class,
|
||||
];
|
||||
|
||||
public function sport()
|
||||
{
|
||||
return $this->belongsTo(Sport::class, 'sport_id');
|
||||
return $this->belongsTo(Sport::class);
|
||||
}
|
||||
|
||||
public function bookmaker()
|
||||
{
|
||||
return $this->belongsTo(Bookmaker::class, 'bookmaker_id');
|
||||
return $this->belongsTo(Bookmaker::class);
|
||||
}
|
||||
|
||||
public function matchpart()
|
||||
{
|
||||
return $this->belongsTo(Matchpart::class, 'matchpart_id');
|
||||
return $this->belongsTo(Matchpart::class);
|
||||
}
|
||||
|
||||
public function event()
|
||||
{
|
||||
return $this->belongsTo(Event::class, 'event_id');
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return $this->belongsTo(Provider::class);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\EnumMatchpart;
|
||||
use App\Enums\EnumSuspended;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OddsHandicap extends Model
|
||||
@@ -16,39 +15,43 @@ class OddsHandicap extends Model
|
||||
'sport_id',
|
||||
'matchpart_id',
|
||||
'bookmaker_id',
|
||||
'bookmaker',
|
||||
'suspended',
|
||||
'oddshash',
|
||||
'provider_id',
|
||||
'home',
|
||||
'away',
|
||||
'handicap',
|
||||
'margin',
|
||||
'flag',
|
||||
'check',
|
||||
'add_time',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'suspended' => EnumSuspended::class,
|
||||
'matchpart_id' => EnumMatchpart::class,
|
||||
];
|
||||
|
||||
public function sport()
|
||||
{
|
||||
return $this->belongsTo(Sport::class, 'sport_id');
|
||||
return $this->belongsTo(Sport::class);
|
||||
}
|
||||
|
||||
public function bookmaker()
|
||||
{
|
||||
return $this->belongsTo(Bookmaker::class, 'bookmaker_id');
|
||||
return $this->belongsTo(Bookmaker::class);
|
||||
}
|
||||
|
||||
public function matchpart()
|
||||
{
|
||||
return $this->belongsTo(Matchpart::class, 'matchpart_id');
|
||||
return $this->belongsTo(Matchpart::class);
|
||||
}
|
||||
|
||||
public function event()
|
||||
{
|
||||
return $this->belongsTo(Event::class, 'event_id');
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return $this->belongsTo(Provider::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OddsQualify extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'event_id',
|
||||
'sport_id',
|
||||
'matchpart_id',
|
||||
'bookmaker_id',
|
||||
'provider_id',
|
||||
'htq',
|
||||
'atq',
|
||||
'margin',
|
||||
'flag',
|
||||
'check',
|
||||
'add_time',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'matchpart_id' => EnumMatchpart::class,
|
||||
];
|
||||
|
||||
public function sport()
|
||||
{
|
||||
return $this->belongsTo(Sport::class);
|
||||
}
|
||||
|
||||
public function bookmaker()
|
||||
{
|
||||
return $this->belongsTo(Bookmaker::class);
|
||||
}
|
||||
|
||||
public function matchpart()
|
||||
{
|
||||
return $this->belongsTo(Matchpart::class);
|
||||
}
|
||||
|
||||
public function event()
|
||||
{
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return $this->belongsTo(Provider::class);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\EnumMatchpart;
|
||||
use App\Enums\EnumSuspended;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OddsTotal extends Model
|
||||
@@ -16,39 +15,43 @@ class OddsTotal extends Model
|
||||
'sport_id',
|
||||
'matchpart_id',
|
||||
'bookmaker_id',
|
||||
'bookmaker',
|
||||
'suspended',
|
||||
'oddshash',
|
||||
'provider_id',
|
||||
'over',
|
||||
'under',
|
||||
'spread',
|
||||
'margin',
|
||||
'flag',
|
||||
'check',
|
||||
'add_time',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'suspended' => EnumSuspended::class,
|
||||
'matchpart_id' => EnumMatchpart::class,
|
||||
];
|
||||
|
||||
public function sport()
|
||||
{
|
||||
return $this->belongsTo(Sport::class, 'sport_id');
|
||||
return $this->belongsTo(Sport::class);
|
||||
}
|
||||
|
||||
public function bookmaker()
|
||||
{
|
||||
return $this->belongsTo(Bookmaker::class, 'bookmaker_id');
|
||||
return $this->belongsTo(Bookmaker::class);
|
||||
}
|
||||
|
||||
public function matchpart()
|
||||
{
|
||||
return $this->belongsTo(Matchpart::class, 'matchpart_id');
|
||||
return $this->belongsTo(Matchpart::class);
|
||||
}
|
||||
|
||||
public function event()
|
||||
{
|
||||
return $this->belongsTo(Event::class, 'event_id');
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return $this->belongsTo(Provider::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Provider extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name',
|
||||
];
|
||||
}
|
||||
@@ -46,4 +46,9 @@ class User extends Authenticatable
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
||||
|
||||
public function client()
|
||||
{
|
||||
return $this->belongsTo(Client::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Bookmaker;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class BookmakerPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->can('view_any_bookmakers::bookmaker');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, Bookmaker $bookmaker): bool
|
||||
{
|
||||
return $user->can('view_bookmakers::bookmaker');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->can('create_bookmakers::bookmaker');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, Bookmaker $bookmaker): bool
|
||||
{
|
||||
return $user->can('update_bookmakers::bookmaker');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, Bookmaker $bookmaker): bool
|
||||
{
|
||||
return $user->can('delete_bookmakers::bookmaker');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk delete.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->can('delete_any_bookmakers::bookmaker');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete.
|
||||
*/
|
||||
public function forceDelete(User $user, Bookmaker $bookmaker): bool
|
||||
{
|
||||
return $user->can('force_delete_bookmakers::bookmaker');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently bulk delete.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->can('force_delete_any_bookmakers::bookmaker');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore.
|
||||
*/
|
||||
public function restore(User $user, Bookmaker $bookmaker): bool
|
||||
{
|
||||
return $user->can('restore_bookmakers::bookmaker');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk restore.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->can('restore_any_bookmakers::bookmaker');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate.
|
||||
*/
|
||||
public function replicate(User $user, Bookmaker $bookmaker): bool
|
||||
{
|
||||
return $user->can('replicate_bookmakers::bookmaker');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->can('reorder_bookmakers::bookmaker');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Provider;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class ProviderPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->can('view_any_providers::provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, Provider $provider): bool
|
||||
{
|
||||
return $user->can('view_providers::provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->can('create_providers::provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, Provider $provider): bool
|
||||
{
|
||||
return $user->can('update_providers::provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, Provider $provider): bool
|
||||
{
|
||||
return $user->can('delete_providers::provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk delete.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->can('delete_any_providers::provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete.
|
||||
*/
|
||||
public function forceDelete(User $user, Provider $provider): bool
|
||||
{
|
||||
return $user->can('force_delete_providers::provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently bulk delete.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->can('force_delete_any_providers::provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore.
|
||||
*/
|
||||
public function restore(User $user, Provider $provider): bool
|
||||
{
|
||||
return $user->can('restore_providers::provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk restore.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->can('restore_any_providers::provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate.
|
||||
*/
|
||||
public function replicate(User $user, Provider $provider): bool
|
||||
{
|
||||
return $user->can('replicate_providers::provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->can('reorder_providers::provider');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user