wip
This commit is contained in:
1 parent
8f6ca51fc3
commit
3149fa6c12
4 files changed
+156
No files matched your search
+1
@@ -53,6 +53,7 @@ class StatistikoImportsTable
|
||||
'player' => 'Player',
|
||||
]),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->filtersFormColumns(6)
|
||||
->persistFiltersInSession()
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports\Helper;
|
||||
|
||||
use App\Models\StatistikoPlayer;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\LazyCollection;
|
||||
use Spatie\SimpleExcel\SimpleExcelReader;
|
||||
|
||||
class ImportMarcatori
|
||||
{
|
||||
public static function run(string $filePath): void
|
||||
{
|
||||
$now = now()->format('Y-m-d H:i:s');
|
||||
|
||||
SimpleExcelReader::create(storage_path('app/public/'.$filePath))
|
||||
->getRows()
|
||||
->chunk(1000)
|
||||
->each(function (LazyCollection $chunk) use ($now) {
|
||||
|
||||
foreach ($chunk as $row) {
|
||||
|
||||
$row = array_values($row);
|
||||
|
||||
StatistikoPlayer::where('player_id', $row[0])
|
||||
->update(
|
||||
[
|
||||
'name' => $row[1],
|
||||
'birthdate' => Carbon::parse($row[2])->toDateString(),
|
||||
'height' => $row[3],
|
||||
'nationality' => $row[4],
|
||||
'position' => $row[5],
|
||||
'sport_radar_id' => $row[6],
|
||||
'id_squadra_tm' => $row[7],
|
||||
'full_name' => $row[8],
|
||||
'no_specialities' => $row[9],
|
||||
'rigorist' => $row[10],
|
||||
'national_team_id' => $row[11],
|
||||
'last_update' => Carbon::parse($row[12])->toDateString(),
|
||||
'league_code' => $row[13],
|
||||
'team_code' => $row[14],
|
||||
'team_name' => $row[15],
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
],
|
||||
['upsert' => true],
|
||||
);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use MongoDB\Laravel\Eloquent\Model;
|
||||
|
||||
class StatistikoMarcatori extends Model
|
||||
{
|
||||
protected $connection = 'mongodb';
|
||||
|
||||
protected $table = 'marcatori';
|
||||
|
||||
protected $fillable = [
|
||||
'match_id',
|
||||
'player_id',
|
||||
];
|
||||
}
|
||||
|
||||
// match_id
|
||||
// player_id
|
||||
// playersubstitute_id
|
||||
// goals
|
||||
// assists
|
||||
// own_goals
|
||||
// shots_on_target
|
||||
// shots_off_target
|
||||
// shots_blocked
|
||||
// fouls
|
||||
// was_fouled
|
||||
// offsides
|
||||
// possessions_lost
|
||||
// total_tackles
|
||||
// touches
|
||||
// total_cross
|
||||
// cross_done
|
||||
// total_dribbles
|
||||
// dribbles_won
|
||||
// total_ground_duels
|
||||
// total_ground_duels_won
|
||||
// total_aerial_duels
|
||||
// total_duels_aerial_won
|
||||
// total_pass
|
||||
// pass
|
||||
// total_long_balls
|
||||
// long_balls
|
||||
// blocked_shots
|
||||
// clearances
|
||||
// dribbled_past
|
||||
// hit_woodwork
|
||||
// interceptions
|
||||
// key_pass
|
||||
// last_man_tackle
|
||||
// dispossessed
|
||||
// clearance_off_line
|
||||
// bcc
|
||||
// bcm
|
||||
// errors_lead_to_a_goal
|
||||
// errors_lead_to_a_shot
|
||||
// penalty_committed
|
||||
// penalty_miss
|
||||
// penalty_save
|
||||
// penalty_won
|
||||
// saves
|
||||
// saves_from_in_box
|
||||
// total_runs_out
|
||||
// runs_out
|
||||
// punches
|
||||
// good_high_claim
|
||||
// minutes_played
|
||||
// lineup
|
||||
// minute_event_during_the_match
|
||||
// type_event_during_the_match
|
||||
// description_event_during_the_match
|
||||
// subtype_event_during_the_match
|
||||
// player_position
|
||||
// playerrating_value
|
||||
// tm_player_id
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use MongoDB\Laravel\Schema\Blueprint;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
protected $connection = 'mongodb';
|
||||
|
||||
/**
|
||||
* Player Details
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('marcatori', function (Blueprint $collection) {
|
||||
$collection->index('match_id');
|
||||
$collection->index('player_id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('marcatori');
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user