wip SimpleExcelReader with LazyCollection
This commit is contained in:
1 parent
baa1117f61
commit
048989fed8
6 files changed
+442
-200
No files matched your search
+21
-4
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoImports\Tables;
|
||||
|
||||
use App\Filament\Imports\StatistikoImporter;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\SelectColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
@@ -18,6 +20,7 @@ class StatistikoImportsTable
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->striped()
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
->label('Sport')
|
||||
@@ -57,11 +60,25 @@ class StatistikoImportsTable
|
||||
->recordActions([
|
||||
ActionGroup::make([
|
||||
Action::make('Import')
|
||||
->label('Just Import (very fast)')
|
||||
->icon('phosphor-database'),
|
||||
->label('Import (fast)')
|
||||
->icon('phosphor-database')
|
||||
->action(function ($record) {
|
||||
StatistikoImporter::run('import', $record);
|
||||
})->successNotification(
|
||||
Notification::make()
|
||||
->info()
|
||||
->title('Import started')
|
||||
),
|
||||
Action::make('Update')
|
||||
->label('Import and Update (slow)')
|
||||
->icon('phosphor-database'),
|
||||
->label('Update or Import (slow)')
|
||||
->icon('phosphor-database')
|
||||
->action(function ($record) {
|
||||
StatistikoImporter::run('update', $record);
|
||||
})->successNotification(
|
||||
Notification::make()
|
||||
->info()
|
||||
->title('Import & Update started')
|
||||
),
|
||||
DeleteAction::make()
|
||||
->label('Delete file'),
|
||||
]),
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\StatistikoPlayer;
|
||||
use Filament\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Concurrency;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Illuminate\Support\LazyCollection;
|
||||
use Illuminate\Support\Str;
|
||||
use Spatie\SimpleExcel\SimpleExcelReader;
|
||||
|
||||
class StatistikoImporter
|
||||
{
|
||||
public static float $benchmarkStartTime;
|
||||
|
||||
public static int $benchmarkStartMemory;
|
||||
|
||||
public static int $startRowCount;
|
||||
|
||||
public static int $startQueries;
|
||||
|
||||
public static function run($mode, $record): void
|
||||
{
|
||||
error_reporting(E_ALL);
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
$table = $record['data_type'];
|
||||
|
||||
$filePath = storage_path().'/app/private/'.$record['file_name'];
|
||||
|
||||
self::startBenchmark($table);
|
||||
|
||||
try {
|
||||
self::handleImport($filePath, $table, $mode);
|
||||
} catch (\Exception $e) {
|
||||
dd(get_class($e).' '.Str::of($e->getMessage())->limit(100)->value());
|
||||
}
|
||||
|
||||
self::endBenchmark();
|
||||
}
|
||||
|
||||
protected static function startBenchmark(string $table): void
|
||||
{
|
||||
self::$startRowCount = DB::connection('mongodb')->table($table)->count();
|
||||
self::$benchmarkStartTime = microtime(true);
|
||||
self::$benchmarkStartMemory = memory_get_usage();
|
||||
DB::connection('mongodb')->enableQueryLog();
|
||||
}
|
||||
|
||||
protected static function endBenchmark(string $table = 'customers'): void
|
||||
{
|
||||
$executionTime = microtime(true) - self::$benchmarkStartTime;
|
||||
$memoryUsage = round((memory_get_usage() - self::$benchmarkStartMemory) / 1024 / 1024, 2);
|
||||
|
||||
$logs = DB::connection('mongodb')->getQueryLog();
|
||||
$queriesCount = \count($logs);
|
||||
|
||||
// Get row count after we've stopped tracking queries
|
||||
$rowDiff = DB::connection('mongodb')->table($table)->count() - self::$startRowCount;
|
||||
|
||||
$formattedTime = match (true) {
|
||||
$executionTime >= 60 => sprintf('%dm %ds', floor($executionTime / 60), $executionTime % 60),
|
||||
$executionTime >= 1 => round($executionTime, 2).'s',
|
||||
default => round($executionTime * 1000).'ms',
|
||||
};
|
||||
|
||||
$str = '⚡ TIME: '.$formattedTime;
|
||||
$str .= '<br/>MEM: '.$memoryUsage.'MB';
|
||||
$str .= '<br/>SQL: '.number_format($queriesCount);
|
||||
$str .= '<br/>ROWS: '.number_format($rowDiff);
|
||||
|
||||
$recipient = auth()->user();
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Import compleated')
|
||||
->body(new HtmlString($str))
|
||||
->sendToDatabase($recipient);
|
||||
}
|
||||
|
||||
private static function handleImport(string $filePath, $table, $mode): void
|
||||
{
|
||||
$now = now()->format('Y-m-d H:i:s');
|
||||
|
||||
$chunkSize = 1000;
|
||||
|
||||
SimpleExcelReader::create($filePath)
|
||||
->getRows()
|
||||
->chunk($chunkSize)
|
||||
->each(function ($rowProperties) {
|
||||
dd($rowProperties);
|
||||
// processing rows
|
||||
});
|
||||
|
||||
// LazyCollection::make(function () use ($filePath) {
|
||||
// $handle = fopen($filePath, 'r');
|
||||
// fgets($handle); // skip header
|
||||
|
||||
// while (($line = fgets($handle)) !== false) {
|
||||
// yield str_getcsv($line);
|
||||
// }
|
||||
// fclose($handle);
|
||||
// })->each(function ($row) {
|
||||
// dd($row);
|
||||
// });
|
||||
// ->map(fn ($row) => [
|
||||
// 'custom_id' => $row[0],
|
||||
// 'name' => $row[1],
|
||||
// 'email' => $row[2],
|
||||
// 'company' => $row[3],
|
||||
// 'city' => $row[4],
|
||||
// 'country' => $row[5],
|
||||
// 'birthday' => $row[6],
|
||||
// 'created_at' => $now,
|
||||
// 'updated_at' => $now,
|
||||
// ])
|
||||
// ->chunk($chunkSize)
|
||||
// ->each(fn ($chunk) => $result = StatistikoPlayer::upsert(
|
||||
// [
|
||||
// ['title' => 'Inspector Maigret', 'recommended' => false, 'runtime' => 128],
|
||||
// ['title' => 'Petit Maman', 'recommended' => true, 'runtime' => 72],
|
||||
// ],
|
||||
// 'title',
|
||||
// 'recommended',
|
||||
// ));
|
||||
}
|
||||
|
||||
private static function import11Concurrent(string $filePath): void
|
||||
{
|
||||
// 100 168ms
|
||||
// 1K 172ms
|
||||
// 10K 234ms
|
||||
// 100K 595ms
|
||||
// 1M 4.36s
|
||||
// 2M 8.8s
|
||||
$now = now()->format('Y-m-d H:i:s');
|
||||
$numberOfProcesses = 10;
|
||||
|
||||
$tasks = [];
|
||||
for ($i = 0; $i < $numberOfProcesses; $i++) {
|
||||
$tasks[] = function () use ($filePath, $i, $numberOfProcesses, $now) {
|
||||
DB::reconnect();
|
||||
|
||||
$handle = fopen($filePath, 'r');
|
||||
fgets($handle); // Skip header
|
||||
$currentLine = 0;
|
||||
$customers = [];
|
||||
|
||||
while (($line = fgets($handle)) !== false) {
|
||||
// Each process takes every Nth line
|
||||
if ($currentLine++ % $numberOfProcesses !== $i) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$row = str_getcsv($line);
|
||||
$customers[] = [
|
||||
'custom_id' => $row[0],
|
||||
'name' => $row[1],
|
||||
'email' => $row[2],
|
||||
'company' => $row[3],
|
||||
'city' => $row[4],
|
||||
'country' => $row[5],
|
||||
'birthday' => $row[6],
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
];
|
||||
|
||||
if (count($customers) === 1000) {
|
||||
DB::table('customers')->insert($customers);
|
||||
$customers = [];
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($customers)) {
|
||||
DB::table('customers')->insert($customers);
|
||||
}
|
||||
|
||||
fclose($handle);
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
Concurrency::run($tasks);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,18 +13,18 @@ class StatistikoPlayer extends Model
|
||||
protected $table = 'player';
|
||||
|
||||
protected $fillable = [
|
||||
'id_giocatore',
|
||||
'giocatore',
|
||||
'data_di_nascita',
|
||||
'altezza',
|
||||
'nazionalita',
|
||||
'posizione',
|
||||
'player_id',
|
||||
'name',
|
||||
'full_name',
|
||||
'birthdate',
|
||||
'height',
|
||||
'nationality',
|
||||
'position',
|
||||
'sport_radar_id',
|
||||
'id_squadra_tm',
|
||||
'nome_completo',
|
||||
'rigorista',
|
||||
'rigorist',
|
||||
'national_team_id',
|
||||
'data_aggiornamento',
|
||||
'last_update',
|
||||
'league_code',
|
||||
'team_code',
|
||||
'team_name',
|
||||
@@ -33,8 +33,8 @@ class StatistikoPlayer extends Model
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'data_di_nascita' => 'date',
|
||||
'data_aggiornamento' => 'date',
|
||||
'birthdate' => 'date',
|
||||
'last_update' => 'date',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use Agencetwogether\HooksHelper\HooksHelperPlugin;
|
||||
// use Agencetwogether\HooksHelper\HooksHelperPlugin;
|
||||
use App\Filament\Exports\BetfairExporter;
|
||||
use App\Http\Middleware\RecordUserActivity;
|
||||
use Awcodes\LightSwitch\Enums\Alignment;
|
||||
@@ -18,7 +18,7 @@ use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\AuthenticateSession;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
||||
use Filament\Pages\Dashboard;
|
||||
// use Filament\Pages\Dashboard;
|
||||
use Filament\Panel;
|
||||
use Filament\PanelProvider;
|
||||
use Filament\Support\Enums\Width;
|
||||
@@ -65,7 +65,7 @@ class AdminPanelProvider extends PanelProvider
|
||||
->emailVerification()
|
||||
->emailChangeVerification()
|
||||
->databaseNotifications()
|
||||
// ->databaseNotificationsPolling('15s') default is 30
|
||||
->databaseNotificationsPolling('10s') // default is 30
|
||||
->sidebarCollapsibleOnDesktop()
|
||||
->profile(isSimple: false)
|
||||
->default()
|
||||
|
||||
Generated
+195
-182
@@ -2955,20 +2955,20 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v11.51.0",
|
||||
"version": "v12.56.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "c8f9a04594b7044a189a3194cfb3594251eb74e5"
|
||||
"reference": "dac16d424b59debb2273910dde88eb7050a2a709"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/c8f9a04594b7044a189a3194cfb3594251eb74e5",
|
||||
"reference": "c8f9a04594b7044a189a3194cfb3594251eb74e5",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/dac16d424b59debb2273910dde88eb7050a2a709",
|
||||
"reference": "dac16d424b59debb2273910dde88eb7050a2a709",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"brick/math": "^0.9.3|^0.10.2|^0.11|^0.12|^0.13|^0.14",
|
||||
"brick/math": "^0.11|^0.12|^0.13|^0.14",
|
||||
"composer-runtime-api": "^2.2",
|
||||
"doctrine/inflector": "^2.0.5",
|
||||
"dragonmantank/cron-expression": "^3.4",
|
||||
@@ -2983,32 +2983,34 @@
|
||||
"fruitcake/php-cors": "^1.3",
|
||||
"guzzlehttp/guzzle": "^7.8.2",
|
||||
"guzzlehttp/uri-template": "^1.0",
|
||||
"laravel/prompts": "^0.1.18|^0.2.0|^0.3.0",
|
||||
"laravel/prompts": "^0.3.0",
|
||||
"laravel/serializable-closure": "^1.3|^2.0",
|
||||
"league/commonmark": "^2.7",
|
||||
"league/commonmark": "^2.8.1",
|
||||
"league/flysystem": "^3.25.1",
|
||||
"league/flysystem-local": "^3.25.1",
|
||||
"league/uri": "^7.5.1",
|
||||
"monolog/monolog": "^3.0",
|
||||
"nesbot/carbon": "^2.72.6|^3.8.4",
|
||||
"nesbot/carbon": "^3.8.4",
|
||||
"nunomaduro/termwind": "^2.0",
|
||||
"php": "^8.2",
|
||||
"psr/container": "^1.1.1|^2.0.1",
|
||||
"psr/log": "^1.0|^2.0|^3.0",
|
||||
"psr/simple-cache": "^1.0|^2.0|^3.0",
|
||||
"ramsey/uuid": "^4.7",
|
||||
"symfony/console": "^7.0.3",
|
||||
"symfony/error-handler": "^7.0.3",
|
||||
"symfony/finder": "^7.0.3",
|
||||
"symfony/console": "^7.2.0",
|
||||
"symfony/error-handler": "^7.2.0",
|
||||
"symfony/finder": "^7.2.0",
|
||||
"symfony/http-foundation": "^7.2.0",
|
||||
"symfony/http-kernel": "^7.0.3",
|
||||
"symfony/mailer": "^7.0.3",
|
||||
"symfony/mime": "^7.0.3",
|
||||
"symfony/polyfill-php83": "^1.31",
|
||||
"symfony/process": "^7.0.3",
|
||||
"symfony/routing": "^7.0.3",
|
||||
"symfony/uid": "^7.0.3",
|
||||
"symfony/var-dumper": "^7.0.3",
|
||||
"symfony/http-kernel": "^7.2.0",
|
||||
"symfony/mailer": "^7.2.0",
|
||||
"symfony/mime": "^7.2.0",
|
||||
"symfony/polyfill-php83": "^1.33",
|
||||
"symfony/polyfill-php84": "^1.33",
|
||||
"symfony/polyfill-php85": "^1.33",
|
||||
"symfony/process": "^7.2.0",
|
||||
"symfony/routing": "^7.2.0",
|
||||
"symfony/uid": "^7.2.0",
|
||||
"symfony/var-dumper": "^7.2.0",
|
||||
"tijsverkoyen/css-to-inline-styles": "^2.2.5",
|
||||
"vlucas/phpdotenv": "^5.6.1",
|
||||
"voku/portable-ascii": "^2.0.2"
|
||||
@@ -3040,6 +3042,7 @@
|
||||
"illuminate/filesystem": "self.version",
|
||||
"illuminate/hashing": "self.version",
|
||||
"illuminate/http": "self.version",
|
||||
"illuminate/json-schema": "self.version",
|
||||
"illuminate/log": "self.version",
|
||||
"illuminate/macroable": "self.version",
|
||||
"illuminate/mail": "self.version",
|
||||
@@ -3049,6 +3052,7 @@
|
||||
"illuminate/process": "self.version",
|
||||
"illuminate/queue": "self.version",
|
||||
"illuminate/redis": "self.version",
|
||||
"illuminate/reflection": "self.version",
|
||||
"illuminate/routing": "self.version",
|
||||
"illuminate/session": "self.version",
|
||||
"illuminate/support": "self.version",
|
||||
@@ -3072,17 +3076,18 @@
|
||||
"league/flysystem-read-only": "^3.25.1",
|
||||
"league/flysystem-sftp-v3": "^3.25.1",
|
||||
"mockery/mockery": "^1.6.10",
|
||||
"orchestra/testbench-core": "^9.18.0",
|
||||
"pda/pheanstalk": "^5.0.6",
|
||||
"opis/json-schema": "^2.4.1",
|
||||
"orchestra/testbench-core": "^10.9.0",
|
||||
"pda/pheanstalk": "^5.0.6|^7.0.0",
|
||||
"php-http/discovery": "^1.15",
|
||||
"phpstan/phpstan": "2.1.41",
|
||||
"phpunit/phpunit": "^10.5.35|^11.3.6|^12.0.1",
|
||||
"predis/predis": "^2.3",
|
||||
"resend/resend-php": "^0.10.0",
|
||||
"symfony/cache": "^7.0.3",
|
||||
"symfony/http-client": "^7.0.3",
|
||||
"symfony/psr-http-message-bridge": "^7.0.3",
|
||||
"symfony/translation": "^7.0.3"
|
||||
"phpstan/phpstan": "^2.1.41",
|
||||
"phpunit/phpunit": "^10.5.35|^11.5.3|^12.0.1",
|
||||
"predis/predis": "^2.3|^3.0",
|
||||
"resend/resend-php": "^0.10.0|^1.0",
|
||||
"symfony/cache": "^7.2.0",
|
||||
"symfony/http-client": "^7.2.0",
|
||||
"symfony/psr-http-message-bridge": "^7.2.0",
|
||||
"symfony/translation": "^7.2.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ably/ably-php": "Required to use the Ably broadcast driver (^1.0).",
|
||||
@@ -3097,7 +3102,7 @@
|
||||
"ext-pdo": "Required to use all database features.",
|
||||
"ext-posix": "Required to use all features of the queue worker.",
|
||||
"ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0|^6.0).",
|
||||
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
|
||||
"fakerphp/faker": "Required to generate fake data using the fake() helper (^1.23).",
|
||||
"filp/whoops": "Required for friendly error pages in development (^2.14.3).",
|
||||
"laravel/tinker": "Required to use the tinker console command (^2.0).",
|
||||
"league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^3.25.1).",
|
||||
@@ -3108,22 +3113,22 @@
|
||||
"mockery/mockery": "Required to use mocking (^1.6).",
|
||||
"pda/pheanstalk": "Required to use the beanstalk queue driver (^5.0).",
|
||||
"php-http/discovery": "Required to use PSR-7 bridging features (^1.15).",
|
||||
"phpunit/phpunit": "Required to use assertions and run tests (^10.5.35|^11.3.6|^12.0.1).",
|
||||
"predis/predis": "Required to use the predis connector (^2.3).",
|
||||
"phpunit/phpunit": "Required to use assertions and run tests (^10.5.35|^11.5.3|^12.0.1).",
|
||||
"predis/predis": "Required to use the predis connector (^2.3|^3.0).",
|
||||
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
|
||||
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0|^7.0).",
|
||||
"resend/resend-php": "Required to enable support for the Resend mail transport (^0.10.0).",
|
||||
"symfony/cache": "Required to PSR-6 cache bridge (^7.0).",
|
||||
"symfony/filesystem": "Required to enable support for relative symbolic links (^7.0).",
|
||||
"symfony/http-client": "Required to enable support for the Symfony API mail transports (^7.0).",
|
||||
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^7.0).",
|
||||
"symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^7.0).",
|
||||
"symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^7.0)."
|
||||
"resend/resend-php": "Required to enable support for the Resend mail transport (^0.10.0|^1.0).",
|
||||
"symfony/cache": "Required to PSR-6 cache bridge (^7.2).",
|
||||
"symfony/filesystem": "Required to enable support for relative symbolic links (^7.2).",
|
||||
"symfony/http-client": "Required to enable support for the Symfony API mail transports (^7.2).",
|
||||
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^7.2).",
|
||||
"symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^7.2).",
|
||||
"symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^7.2)."
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "11.x-dev"
|
||||
"dev-master": "12.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -3134,6 +3139,7 @@
|
||||
"src/Illuminate/Filesystem/functions.php",
|
||||
"src/Illuminate/Foundation/helpers.php",
|
||||
"src/Illuminate/Log/functions.php",
|
||||
"src/Illuminate/Reflection/helpers.php",
|
||||
"src/Illuminate/Support/functions.php",
|
||||
"src/Illuminate/Support/helpers.php"
|
||||
],
|
||||
@@ -3142,7 +3148,8 @@
|
||||
"Illuminate\\Support\\": [
|
||||
"src/Illuminate/Macroable/",
|
||||
"src/Illuminate/Collections/",
|
||||
"src/Illuminate/Conditionable/"
|
||||
"src/Illuminate/Conditionable/",
|
||||
"src/Illuminate/Reflection/"
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -3166,7 +3173,7 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2026-03-26T14:54:53+00:00"
|
||||
"time": "2026-03-26T14:51:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/prompts",
|
||||
@@ -4413,27 +4420,27 @@
|
||||
},
|
||||
{
|
||||
"name": "mongodb/laravel-mongodb",
|
||||
"version": "5.1.1",
|
||||
"version": "5.7.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mongodb/laravel-mongodb.git",
|
||||
"reference": "cc7e5ffd0e8e3a9acfebd7aa5a5aabac2fc5eac4"
|
||||
"url": "https://github.com/mongodb/laravel-mongodb",
|
||||
"reference": "6e371e8e6deb9193f99a84c578e6c9d0a960e43a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mongodb/laravel-mongodb/zipball/cc7e5ffd0e8e3a9acfebd7aa5a5aabac2fc5eac4",
|
||||
"reference": "cc7e5ffd0e8e3a9acfebd7aa5a5aabac2fc5eac4",
|
||||
"url": "https://api.github.com/repos/mongodb/laravel-mongodb/zipball/6e371e8e6deb9193f99a84c578e6c9d0a960e43a",
|
||||
"reference": "6e371e8e6deb9193f99a84c578e6c9d0a960e43a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-runtime-api": "^2.0.0",
|
||||
"ext-mongodb": "^1.15",
|
||||
"illuminate/cache": "^10.36|^11",
|
||||
"illuminate/container": "^10.0|^11",
|
||||
"illuminate/database": "^10.30|^11",
|
||||
"illuminate/events": "^10.0|^11",
|
||||
"illuminate/support": "^10.0|^11",
|
||||
"mongodb/mongodb": "^1.18",
|
||||
"ext-mongodb": "^1.21|^2",
|
||||
"illuminate/cache": "^10.36|^11|^12|^13.0",
|
||||
"illuminate/container": "^10.0|^11|^12|^13.0",
|
||||
"illuminate/database": "^10.30|^11|^12|^13.0",
|
||||
"illuminate/events": "^10.0|^11|^12|^13.0",
|
||||
"illuminate/support": "^10.0|^11|^12|^13.0",
|
||||
"mongodb/mongodb": "^1.21|^2",
|
||||
"php": "^8.1"
|
||||
},
|
||||
"conflict": {
|
||||
@@ -4443,20 +4450,19 @@
|
||||
"jenssegers/mongodb": "self.version"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "12.0.x-dev",
|
||||
"doctrine/coding-standard": "^12.0",
|
||||
"laravel/scout": "^10.3",
|
||||
"league/flysystem-gridfs": "^3.28",
|
||||
"league/flysystem-read-only": "^3.0",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"mongodb/builder": "^0.2",
|
||||
"orchestra/testbench": "^8.0|^9.0",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phpunit/phpunit": "^10.3",
|
||||
"rector/rector": "^1.2",
|
||||
"spatie/laravel-query-builder": "^5.6"
|
||||
"orchestra/testbench": "^8.0|^9.0|^10.0|^11.0",
|
||||
"phpstan/phpstan": "^1.10|^2.1",
|
||||
"phpunit/phpunit": "^10.3|^11.5.3|^12.5.12",
|
||||
"rector/rector": "^1.2|^2.3",
|
||||
"spatie/laravel-query-builder": "^5.6|^6"
|
||||
},
|
||||
"suggest": {
|
||||
"league/flysystem-gridfs": "Filesystem storage in MongoDB with GridFS",
|
||||
"mongodb/builder": "Provides a fluent aggregation builder for MongoDB pipelines"
|
||||
"league/flysystem-gridfs": "Filesystem storage in MongoDB with GridFS"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -4482,6 +4488,11 @@
|
||||
"email": "andreas.braun@mongodb.com",
|
||||
"role": "Leader"
|
||||
},
|
||||
{
|
||||
"name": "Pauline Vos",
|
||||
"email": "pauline.vos@mongodb.com",
|
||||
"role": "Maintainer"
|
||||
},
|
||||
{
|
||||
"name": "Jérôme Tamarelle",
|
||||
"email": "jerome.tamarelle@mongodb.com",
|
||||
@@ -4510,41 +4521,40 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://www.mongodb.com/support",
|
||||
"security": "https://www.mongodb.com/security",
|
||||
"source": "https://github.com/mongodb/laravel-mongodb/tree/5.1.1"
|
||||
"security": "https://www.mongodb.com/security"
|
||||
},
|
||||
"time": "2025-01-06T09:22:28+00:00"
|
||||
"time": "2026-04-15T12:18:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mongodb/mongodb",
|
||||
"version": "1.20.0",
|
||||
"version": "2.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mongodb/mongo-php-library.git",
|
||||
"reference": "75da9ea3b63d97b05e0e8648d8c09a17bc54c0b6"
|
||||
"reference": "bbb13f969e37e047fd822527543df55fdc1c9298"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/75da9ea3b63d97b05e0e8648d8c09a17bc54c0b6",
|
||||
"reference": "75da9ea3b63d97b05e0e8648d8c09a17bc54c0b6",
|
||||
"url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/bbb13f969e37e047fd822527543df55fdc1c9298",
|
||||
"reference": "bbb13f969e37e047fd822527543df55fdc1c9298",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-runtime-api": "^2.0",
|
||||
"ext-hash": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mongodb": "^1.20.0",
|
||||
"php": "^7.4 || ^8.0",
|
||||
"ext-mongodb": "^2.2",
|
||||
"php": "^8.1",
|
||||
"psr/log": "^1.1.4|^2|^3",
|
||||
"symfony/polyfill-php80": "^1.27",
|
||||
"symfony/polyfill-php81": "^1.27"
|
||||
"symfony/polyfill-php85": "^1.32"
|
||||
},
|
||||
"replace": {
|
||||
"mongodb/builder": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^12.0",
|
||||
"rector/rector": "^1.1",
|
||||
"phpunit/phpunit": "^10.5.35",
|
||||
"rector/rector": "^2.3.4",
|
||||
"squizlabs/php_codesniffer": "^3.7",
|
||||
"symfony/phpunit-bridge": "^5.2",
|
||||
"vimeo/psalm": "^5.13"
|
||||
"vimeo/psalm": "~6.14.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -4588,9 +4598,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/mongodb/mongo-php-library/issues",
|
||||
"source": "https://github.com/mongodb/mongo-php-library/tree/1.20.0"
|
||||
"source": "https://github.com/mongodb/mongo-php-library/tree/2.2.0"
|
||||
},
|
||||
"time": "2024-09-25T12:54:08+00:00"
|
||||
"time": "2026-02-11T11:39:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
@@ -6569,31 +6579,34 @@
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-permission",
|
||||
"version": "6.25.0",
|
||||
"version": "7.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/laravel-permission.git",
|
||||
"reference": "d7d4cb0d58616722f1afc90e0484e4825155b9b3"
|
||||
"reference": "5272955119759cd217e84e8bbac19443c305ebc3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-permission/zipball/d7d4cb0d58616722f1afc90e0484e4825155b9b3",
|
||||
"reference": "d7d4cb0d58616722f1afc90e0484e4825155b9b3",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-permission/zipball/5272955119759cd217e84e8bbac19443c305ebc3",
|
||||
"reference": "5272955119759cd217e84e8bbac19443c305ebc3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/auth": "^8.12|^9.0|^10.0|^11.0|^12.0|^13.0",
|
||||
"illuminate/container": "^8.12|^9.0|^10.0|^11.0|^12.0|^13.0",
|
||||
"illuminate/contracts": "^8.12|^9.0|^10.0|^11.0|^12.0|^13.0",
|
||||
"illuminate/database": "^8.12|^9.0|^10.0|^11.0|^12.0|^13.0",
|
||||
"php": "^8.0"
|
||||
"illuminate/auth": "^12.0|^13.0",
|
||||
"illuminate/container": "^12.0|^13.0",
|
||||
"illuminate/contracts": "^12.0|^13.0",
|
||||
"illuminate/database": "^12.0|^13.0",
|
||||
"php": "^8.3",
|
||||
"spatie/laravel-package-tools": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"laravel/passport": "^11.0|^12.0|^13.0",
|
||||
"larastan/larastan": "^3.9",
|
||||
"laravel/passport": "^13.0",
|
||||
"laravel/pint": "^1.0",
|
||||
"orchestra/testbench": "^6.23|^7.0|^8.0|^9.0|^10.0|^11.0",
|
||||
"pestphp/pest": "^2.0|^3.0|^4.0",
|
||||
"pestphp/pest-plugin-laravel": "^2.0|^3.0|^4.0"
|
||||
"orchestra/testbench": "^10.0|^11.0",
|
||||
"pestphp/pest": "^3.0|^4.0",
|
||||
"pestphp/pest-plugin-laravel": "^3.0|^4.1",
|
||||
"phpstan/phpstan": "^2.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -6603,8 +6616,8 @@
|
||||
]
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-main": "6.x-dev",
|
||||
"dev-master": "6.x-dev"
|
||||
"dev-main": "7.x-dev",
|
||||
"dev-master": "7.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -6627,7 +6640,7 @@
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Permission handling for Laravel 8.0 and up",
|
||||
"description": "Permission handling for Laravel 12 and up",
|
||||
"homepage": "https://github.com/spatie/laravel-permission",
|
||||
"keywords": [
|
||||
"acl",
|
||||
@@ -6641,7 +6654,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/spatie/laravel-permission/issues",
|
||||
"source": "https://github.com/spatie/laravel-permission/tree/6.25.0"
|
||||
"source": "https://github.com/spatie/laravel-permission/tree/7.3.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -6649,7 +6662,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-03-17T22:46:46+00:00"
|
||||
"time": "2026-04-07T15:19:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/shiki-php",
|
||||
@@ -8498,86 +8511,6 @@
|
||||
],
|
||||
"time": "2026-04-10T16:19:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php81",
|
||||
"version": "v1.36.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php81.git",
|
||||
"reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
|
||||
"reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php81\\": ""
|
||||
},
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php81/tree/v1.36.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/nicolas-grekas",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php83",
|
||||
"version": "v1.36.0",
|
||||
@@ -8658,6 +8591,86 @@
|
||||
],
|
||||
"time": "2026-04-10T17:25:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php84",
|
||||
"version": "v1.36.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php84.git",
|
||||
"reference": "88486db2c389b290bf87ff1de7ebc1e13e42bb06"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/88486db2c389b290bf87ff1de7ebc1e13e42bb06",
|
||||
"reference": "88486db2c389b290bf87ff1de7ebc1e13e42bb06",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php84\\": ""
|
||||
},
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php84/tree/v1.36.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/nicolas-grekas",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-04-10T18:47:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php85",
|
||||
"version": "v1.36.0",
|
||||
@@ -13580,12 +13593,12 @@
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": {},
|
||||
"stability-flags": [],
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": "^8.3"
|
||||
},
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.9.0"
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use MongoDB\Laravel\Schema\Blueprint;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
protected $connection = 'mongodb';
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('player', function (Blueprint $collection) {
|
||||
$collection->unique('player_id');
|
||||
$collection->index('name');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('player');
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user