fix player marcatori names
This commit is contained in:
1 parent
3149fa6c12
commit
d5563154e0
27 files changed
+508
-339
No files matched your search
+3
-3
@@ -2,12 +2,12 @@
|
||||
|
||||
namespace App\Filament\Imports\Helper;
|
||||
|
||||
use App\Models\StatistikoPlayer;
|
||||
use App\Models\StatistikoDetail;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\LazyCollection;
|
||||
use Spatie\SimpleExcel\SimpleExcelReader;
|
||||
|
||||
class ImportPersonal
|
||||
class ImportDetails
|
||||
{
|
||||
public static function run(string $filePath): void
|
||||
{
|
||||
@@ -22,7 +22,7 @@ class ImportPersonal
|
||||
|
||||
$row = array_values($row);
|
||||
|
||||
StatistikoPlayer::where('player_id', $row[0])
|
||||
StatistikoDetail::where('player_id', $row[0])
|
||||
->update(
|
||||
[
|
||||
'name' => $row[1],
|
||||
@@ -1,52 +0,0 @@
|
||||
<?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,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports\Helper;
|
||||
|
||||
use App\Models\StatistikoPlayer;
|
||||
use Illuminate\Support\LazyCollection;
|
||||
use Spatie\SimpleExcel\SimpleExcelReader;
|
||||
|
||||
class ImportPlayer
|
||||
{
|
||||
public static function run(string $filePath): void
|
||||
{
|
||||
SimpleExcelReader::create(storage_path('app/public/'.$filePath))
|
||||
->getRows()
|
||||
->chunk(1000)
|
||||
->each(function (LazyCollection $chunk) {
|
||||
|
||||
foreach ($chunk as $row) {
|
||||
|
||||
$row = array_values($row);
|
||||
|
||||
StatistikoPlayer::where('match_id', $row[0])
|
||||
->where('player_id', $row[1])
|
||||
->update(
|
||||
[
|
||||
'playersubstitute_id' => $row[2],
|
||||
'goals' => $row[3],
|
||||
'assists' => $row[4],
|
||||
'own_goals' => $row[5],
|
||||
'shots_on_target' => $row[6],
|
||||
'shots_off_target' => $row[7],
|
||||
'shots_blocked' => $row[8],
|
||||
'fouls' => $row[9],
|
||||
'was_fouled' => $row[10],
|
||||
'offsides' => $row[11],
|
||||
'possessions_lost' => $row[12],
|
||||
'total_tackles' => $row[13],
|
||||
'touches' => $row[14],
|
||||
'total_cross' => $row[15],
|
||||
'cross_done' => $row[16],
|
||||
'total_dribbles' => $row[17],
|
||||
'dribbles_won' => $row[18],
|
||||
'total_ground_duels' => $row[19],
|
||||
'total_ground_duels_won' => $row[20],
|
||||
'total_aerial_duels' => $row[21],
|
||||
'total_duels_aerial_won' => $row[22],
|
||||
'total_pass' => $row[23],
|
||||
'pass' => $row[24],
|
||||
'total_long_balls' => $row[25],
|
||||
'long_balls' => $row[26],
|
||||
'blocked_shots' => $row[27],
|
||||
'clearances' => $row[28],
|
||||
'dribbled_past' => $row[29],
|
||||
'hit_woodwork' => $row[30],
|
||||
'interceptions' => $row[31],
|
||||
'key_pass' => $row[32],
|
||||
'last_man_tackle' => $row[33],
|
||||
'dispossessed' => $row[34],
|
||||
'clearance_off_line' => $row[35],
|
||||
'bcc' => $row[36],
|
||||
'bcm' => $row[37],
|
||||
'errors_lead_to_a_goal' => $row[38],
|
||||
'errors_lead_to_a_shot' => $row[39],
|
||||
'penalty_committed' => $row[40],
|
||||
'penalty_miss' => $row[41],
|
||||
'penalty_save' => $row[42],
|
||||
'penalty_won' => $row[43],
|
||||
'saves' => $row[44],
|
||||
'saves_from_in_box' => $row[45],
|
||||
'total_runs_out' => $row[46],
|
||||
'runs_out' => $row[47],
|
||||
'punches' => $row[48],
|
||||
'good_high_claim' => $row[49],
|
||||
'minutes_played' => $row[50],
|
||||
'lineup' => $row[51],
|
||||
'minute_event_during_the_match' => $row[52],
|
||||
'type_event_during_the_match' => $row[53],
|
||||
'description_event_during_the_match' => $row[54],
|
||||
'subtype_event_during_the_match' => $row[55],
|
||||
'player_position' => $row[56],
|
||||
'playerrating_value' => $row[57],
|
||||
'tm_player_id' => $row[58],
|
||||
],
|
||||
['upsert' => true],
|
||||
);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user