This commit is contained in:
salam committed 2025-08-22 06:23:28 +02:00
1 parent e493c4ed42
commit 399b9d43a7
27 files changed
+605 -169

No files matched your search

@@ -0,0 +1,58 @@
<?php
namespace App\Filament\Resources\Clients;
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
use App\Filament\Resources\Clients\Pages\ListClients;
use App\Filament\Resources\Clients\Schemas\ClientForm;
use App\Filament\Resources\Clients\Tables\ClientsTable;
use App\Models\Client;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables\Table;
use UnitEnum;
class ClientResource extends Resource
{
protected static ?string $model = Client::class;
protected static ?int $navigationSort = 30;
protected static string|BackedEnum|null $navigationIcon = 'lucide-square-user';
protected static ?string $recordTitleAttribute = 'name';
protected static string|UnitEnum|null $navigationGroup = 'User Management';
protected static ?string $cluster = MaintenanceCluster::class;
public static function form(Schema $schema): Schema
{
return ClientForm::configure($schema);
}
public static function table(Table $table): Table
{
return ClientsTable::configure($table);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => ListClients::route('/'),
];
}
public static function getNavigationBadge(): ?string
{
return parent::getEloquentQuery()->count();
}
}
@@ -0,0 +1,11 @@
<?php
namespace App\Filament\Resources\Clients\Pages;
use App\Filament\Resources\Clients\ClientResource;
use Filament\Resources\Pages\CreateRecord;
class CreateClient extends CreateRecord
{
protected static string $resource = ClientResource::class;
}
@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Clients\Pages;
use App\Filament\Resources\Clients\ClientResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditClient extends EditRecord
{
protected static string $resource = ClientResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Clients\Pages;
use App\Filament\Resources\Clients\ClientResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListClients extends ListRecords
{
protected static string $resource = ClientResource::class;
protected function getHeaderActions(): array
{
return [
CreateAction::make(),
];
}
}
@@ -0,0 +1,25 @@
<?php
namespace App\Filament\Resources\Clients\Schemas;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;
class ClientForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('name')
->required(),
TextInput::make('icon'),
Select::make('bookmaker')
->relationship('bookmaker', 'name')
->multiple()
->preload()
->searchable(),
]);
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Filament\Resources\Clients\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Table;
class ClientsTable
{
public static function configure(Table $table): Table
{
return $table
->columns([
//
])
->filters([
//
])
->recordActions([
EditAction::make(),
])
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]);
}
}
@@ -3,7 +3,7 @@
namespace App\Filament\Resources\Users\Schemas; namespace App\Filament\Resources\Users\Schemas;
use Filament\Forms\Components\DateTimePicker; use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Textarea; use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema; use Filament\Schemas\Schema;
@@ -23,11 +23,11 @@ class UserForm
TextInput::make('password') TextInput::make('password')
->password() ->password()
->required(), ->required(),
Textarea::make('custom_fields') Select::make('roles')
->default(null) ->relationship('roles', 'name')
->columnSpanFull(), ->multiple()
TextInput::make('avatar_url') ->preload()
->default(null), ->searchable(),
]); ]);
} }
} }
@@ -19,6 +19,8 @@ class UserResource extends Resource
{ {
protected static ?string $model = User::class; protected static ?string $model = User::class;
protected static ?int $navigationSort = 31;
protected static string|BackedEnum|null $navigationIcon = 'lucide-user'; protected static string|BackedEnum|null $navigationIcon = 'lucide-user';
protected static ?string $cluster = MaintenanceCluster::class; protected static ?string $cluster = MaintenanceCluster::class;
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Bookmaker extends Model
{
//
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Client extends Model
{
protected $fillable = [
'name',
'email',
'homepage',
];
public function client_sports()
{
return $this->hasMany(ClientSports::class);
}
public function client_bookmaker()
{
return $this->hasMany(ClientBookmaker::class);
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ClientBookmaker extends Model
{
protected $fillable = [
'client_id',
'bookmaker_id',
'is_active',
];
public function customer()
{
return $this->belongsTo(Client::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
}
+108
View File
@@ -0,0 +1,108 @@
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\Client;
use Illuminate\Auth\Access\HandlesAuthorization;
class ClientPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->can('view_any_clients::client');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Client $client): bool
{
return $user->can('view_clients::client');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->can('create_clients::client');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Client $client): bool
{
return $user->can('update_clients::client');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Client $client): bool
{
return $user->can('delete_clients::client');
}
/**
* Determine whether the user can bulk delete.
*/
public function deleteAny(User $user): bool
{
return $user->can('delete_any_clients::client');
}
/**
* Determine whether the user can permanently delete.
*/
public function forceDelete(User $user, Client $client): bool
{
return $user->can('force_delete_clients::client');
}
/**
* Determine whether the user can permanently bulk delete.
*/
public function forceDeleteAny(User $user): bool
{
return $user->can('force_delete_any_clients::client');
}
/**
* Determine whether the user can restore.
*/
public function restore(User $user, Client $client): bool
{
return $user->can('restore_clients::client');
}
/**
* Determine whether the user can bulk restore.
*/
public function restoreAny(User $user): bool
{
return $user->can('restore_any_clients::client');
}
/**
* Determine whether the user can replicate.
*/
public function replicate(User $user, Client $client): bool
{
return $user->can('replicate_clients::client');
}
/**
* Determine whether the user can reorder.
*/
public function reorder(User $user): bool
{
return $user->can('reorder_clients::client');
}
}
+144
View File
@@ -0,0 +1,144 @@
<?php
namespace App\Policies;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class UserPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return bool
*/
public function viewAny(User $user): bool
{
return $user->can('view_any_users::user');
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @return bool
*/
public function view(User $user): bool
{
return $user->can('view_users::user');
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return bool
*/
public function create(User $user): bool
{
return $user->can('create_users::user');
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @return bool
*/
public function update(User $user): bool
{
return $user->can('update_users::user');
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @return bool
*/
public function delete(User $user): bool
{
return $user->can('delete_users::user');
}
/**
* Determine whether the user can bulk delete.
*
* @param \App\Models\User $user
* @return bool
*/
public function deleteAny(User $user): bool
{
return $user->can('delete_any_users::user');
}
/**
* Determine whether the user can permanently delete.
*
* @param \App\Models\User $user
* @return bool
*/
public function forceDelete(User $user): bool
{
return $user->can('force_delete_users::user');
}
/**
* Determine whether the user can permanently bulk delete.
*
* @param \App\Models\User $user
* @return bool
*/
public function forceDeleteAny(User $user): bool
{
return $user->can('force_delete_any_users::user');
}
/**
* Determine whether the user can restore.
*
* @param \App\Models\User $user
* @return bool
*/
public function restore(User $user): bool
{
return $user->can('restore_users::user');
}
/**
* Determine whether the user can bulk restore.
*
* @param \App\Models\User $user
* @return bool
*/
public function restoreAny(User $user): bool
{
return $user->can('restore_any_users::user');
}
/**
* Determine whether the user can bulk restore.
*
* @param \App\Models\User $user
* @return bool
*/
public function replicate(User $user): bool
{
return $user->can('replicate_users::user');
}
/**
* Determine whether the user can reorder.
*
* @param \App\Models\User $user
* @return bool
*/
public function reorder(User $user): bool
{
return $user->can('reorder_users::user');
}
}
+1 -1
View File
@@ -4,7 +4,7 @@ return [
'shield_resource' => [ 'shield_resource' => [
'should_register_navigation' => true, 'should_register_navigation' => true,
'slug' => 'shield/roles', 'slug' => 'shield/roles',
'navigation_sort' => -1, 'navigation_sort' => 32,
'navigation_badge' => true, 'navigation_badge' => true,
'navigation_group' => true, 'navigation_group' => true,
'sub_navigation_position' => null, 'sub_navigation_position' => null,
@@ -21,6 +21,8 @@ return new class extends Migration
$table->decimal('draw', 7, 3)->default(0); $table->decimal('draw', 7, 3)->default(0);
$table->decimal('away', 7, 3)->default(0); $table->decimal('away', 7, 3)->default(0);
$table->decimal('margin', 7, 3)->default(0); $table->decimal('margin', 7, 3)->default(0);
$table->boolean('flag')->default(0);
$table->boolean('check')->default(0);
$table->integer('add_time')->default(0); $table->integer('add_time')->default(0);
$table->timestamps(); $table->timestamps();
@@ -20,6 +20,8 @@ return new class extends Migration
$table->decimal('home', 7, 3)->default(0); $table->decimal('home', 7, 3)->default(0);
$table->decimal('away', 7, 3)->default(0); $table->decimal('away', 7, 3)->default(0);
$table->decimal('margin', 7, 3)->default(0); $table->decimal('margin', 7, 3)->default(0);
$table->boolean('flag')->default(0);
$table->boolean('check')->default(0);
$table->integer('add_time')->default(0); $table->integer('add_time')->default(0);
$table->timestamps(); $table->timestamps();
}); });
@@ -0,0 +1,38 @@
<?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('odds_dc', function (Blueprint $table) {
$table->id();
$table->foreignId('event_id')->constrained()->cascadeOnDelete();
$table->integer('sport_id')->default(0);
$table->integer('matchpart_id')->default(0);
$table->integer('bookmaker_id')->default(0);
$table->decimal('dc1x', 7, 3)->default(0);
$table->decimal('dc12', 7, 3)->default(0);
$table->decimal('dc2x', 7, 3)->default(0);
$table->decimal('margin', 7, 3)->default(0);
$table->boolean('flag')->default(0);
$table->boolean('check')->default(0);
$table->integer('add_time')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('odds_dc');
}
};
@@ -20,6 +20,8 @@ return new class extends Migration
$table->decimal('dnb1', 7, 3)->default(0); $table->decimal('dnb1', 7, 3)->default(0);
$table->decimal('dnb2', 7, 3)->default(0); $table->decimal('dnb2', 7, 3)->default(0);
$table->decimal('margin', 7, 3)->default(0); $table->decimal('margin', 7, 3)->default(0);
$table->boolean('flag')->default(0);
$table->boolean('check')->default(0);
$table->integer('add_time')->default(0); $table->integer('add_time')->default(0);
$table->timestamps(); $table->timestamps();
}); });
@@ -0,0 +1,37 @@
<?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('odds_ggng', function (Blueprint $table) {
$table->id();
$table->foreignId('event_id')->constrained()->cascadeOnDelete();
$table->integer('sport_id')->default(0);
$table->integer('matchpart_id')->default(0);
$table->integer('bookmaker_id')->default(0);
$table->decimal('gg', 7, 3)->default(0);
$table->decimal('ng', 7, 3)->default(0);
$table->decimal('margin', 7, 3)->default(0);
$table->boolean('flag')->default(0);
$table->boolean('check')->default(0);
$table->integer('add_time')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('odds_ggng');
}
};
@@ -0,0 +1,37 @@
<?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('odds_qualify', function (Blueprint $table) {
$table->id();
$table->foreignId('event_id')->constrained()->cascadeOnDelete();
$table->integer('sport_id')->default(0);
$table->integer('matchpart_id')->default(0);
$table->integer('bookmaker_id')->default(0);
$table->decimal('htq', 7, 3)->default(0);
$table->decimal('atq', 7, 3)->default(0);
$table->decimal('margin', 7, 3)->default(0);
$table->boolean('flag')->default(0);
$table->boolean('check')->default(0);
$table->integer('add_time')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('odds_qualify');
}
};
@@ -21,6 +21,8 @@ return new class extends Migration
$table->decimal('away', 7, 3)->default(0); $table->decimal('away', 7, 3)->default(0);
$table->decimal('handicap', 7, 3)->default(0); $table->decimal('handicap', 7, 3)->default(0);
$table->decimal('margin', 7, 3)->default(0); $table->decimal('margin', 7, 3)->default(0);
$table->boolean('flag')->default(0);
$table->boolean('check')->default(0);
$table->integer('add_time')->default(0); $table->integer('add_time')->default(0);
$table->timestamps(); $table->timestamps();
}); });
@@ -19,8 +19,10 @@ return new class extends Migration
$table->integer('bookmaker_id')->default(0); $table->integer('bookmaker_id')->default(0);
$table->decimal('over', 7, 3)->default(0); $table->decimal('over', 7, 3)->default(0);
$table->decimal('under', 7, 3)->default(0); $table->decimal('under', 7, 3)->default(0);
$table->decimal('spread', 7, 3)->default(0); $table->decimal('total', 7, 3)->default(0);
$table->decimal('margin', 7, 3)->default(0); $table->decimal('margin', 7, 3)->default(0);
$table->boolean('flag')->default(0);
$table->boolean('check')->default(0);
$table->integer('add_time')->default(0); $table->integer('add_time')->default(0);
$table->timestamps(); $table->timestamps();
@@ -15,6 +15,7 @@ return new class extends Migration
$table->id(); $table->id();
$table->string('name'); $table->string('name');
$table->string('icon')->nullable(); $table->string('icon')->nullable();
$table->string('homepage')->nullable();
$table->timestamps(); $table->timestamps();
}); });
} }
@@ -1,78 +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('event_bookmakers', function (Blueprint $table) {
$table->id();
$table->foreignId('event_id')->constrained()->cascadeOnDelete();
$table->timestamp('time')->nullable();
$table->integer('bkid')->default(0);
$table->string('boid')->nullable();
// flag status
$table->integer('flag')->default(0);
// swop (inverted odds)
$table->integer('swop')->default(0);
// 1x2
$table->decimal('h3w', 7, 3)->default(0);
$table->decimal('d3w', 7, 3)->default(0);
$table->decimal('a3w', 7, 3)->default(0);
$table->decimal('m3w', 7, 3)->default(0);
$table->integer('f3w')->default(0);
// bookmaker offer id
// Total
$table->decimal('ov', 7, 3)->default(0);
$table->decimal('un', 7, 3)->default(0);
$table->decimal('hc', 7, 3)->default(0);
$table->decimal('mto', 7, 3)->default(0);
$table->integer('fto')->default(0);
// ML
$table->decimal('h2w', 7, 3)->default(0);
$table->decimal('a2w', 7, 3)->default(0);
$table->decimal('m2w', 7, 3)->default(0);
$table->integer('f2w')->default(0);
// DC
$table->decimal('dc1x', 7, 3)->default(0);
$table->decimal('dc12', 7, 3)->default(0);
$table->decimal('dc2x', 7, 3)->default(0);
$table->decimal('mdc', 7, 3)->default(0);
$table->integer('fdc')->default(0);
// GG NG
$table->decimal('gg', 7, 3)->default(0);
$table->decimal('ng', 7, 3)->default(0);
$table->decimal('mgg', 7, 3)->default(0);
$table->integer('fgg')->default(0);
// TO QUALIFY
$table->decimal('htq', 7, 3)->default(0);
$table->decimal('atq', 7, 3)->default(0);
$table->decimal('mtq', 7, 3)->default(0);
$table->integer('ftq')->default(0);
$table->timestamps();
$table->index(['event_id', 'boid', 'bkid', 'flag']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('event_bookmakers');
}
};
@@ -1,28 +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::table('users', function (Blueprint $table) {
$table->json('custom_fields')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('custom_fields');
});
}
};
@@ -1,28 +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::table('users', function (Blueprint $table) {
$table->string(config('filament-edit-profile.avatar_column', 'avatar_url'))->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(config('filament-edit-profile.avatar_column', 'avatar_url'));
});
}
};
@@ -1,27 +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('customers', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('customers');
}
};