wip details

This commit is contained in:
salam committed 2026-07-30 14:39:24 +02:00
1 parent 62c3f80256
commit 8c372e38ef
12 files changed
+60 -55

No files matched your search

@@ -39,13 +39,13 @@ class Rose
$data = CurlSofa::load($url);
$data['ss_team_id'] = $value->ss_team_id;
$data['ss_team_name'] = $value->ssteam_name;
$data['ss_team_name'] = $value->ss_team_name;
/*********************************
* add team to folder
*********************************/
File::put(Sofascore::$storage . '/' . Strings::clean($value->ssteam_name) . '.json', json_encode($data));
File::put(Sofascore::$storage . '/' . Strings::clean($value->ss_team_name) . '.json', json_encode($data));
SofaScoreRosa::where('id', $value->id)->update(['grapped' => 1]);
@@ -60,7 +60,7 @@ class TournamentTeams
'ss_team_id' => (int) $ss_team_id,
], [
'country_id' => (int) $country_id,
'ssteam_name' => $name,
'ss_team_name' => $name,
'grapped' => 1,
'disabled' => 0,
]);
@@ -23,7 +23,7 @@ class SofaScoreRosasTable
TextColumn::make('ss_team_id')->label('SSId')->badge()->width('1rem'),
TextColumn::make('country.name')->label('Country'),
TextColumn::make('tournament_rosa.tournament.name')->label('Tournament'),
TextColumn::make('ssteam_name')->label('Name'),
TextColumn::make('ss_team_name')->label('Name'),
TextColumn::make('updated_at')->dateTime('Y-m-d H:i:s')
])
->filters([
@@ -24,19 +24,15 @@ class StatistikoDetailsTable
->paginationPageOptions([8, 16, 24, 36])
->columns([
Stack::make([
TextColumn::make('ss_player_id')->prefix('Id: ')->searchable()->color('success')->icon('phosphor-copy')->copyable(),
TextColumn::make('player_name')->searchable()->prefix('Name: ')->color('primary')->icon('phosphor-copy')->copyable(),
TextColumn::make('birthdate')->date()->prefix('Birthdate: '),
TextColumn::make('player_name')->searchable()->color('primary')->icon('phosphor-copy')->copyable(),
TextColumn::make('ss_player_id')->searchable()->color('success')->icon('phosphor-copy')->copyable(),
TextColumn::make('positions.name')->badge()->color('black'),
TextColumn::make('team.ss_team_name')->prefix('Team: ')->color('warning'),
TextColumn::make('birthdate')->prefix('Birthdate: '),
TextColumn::make('height')->prefix('Height: ')->suffix(' cm'),
TextColumn::make('nationality')->prefix('Nationality: '),
TextColumn::make('position')->prefix('Position: '),
TextColumn::make('ss_national_team_id')->prefix('National Team Id: '),
TextColumn::make('tx_team_id')->prefix('Team Id: '),
TextColumn::make('team_name')->prefix('Team Name: '),
TextColumn::make('preferred_foot')->prefix('Preferred Foot: '),
TextColumn::make('last_update')->date()->prefix('Last Update: '),
TextColumn::make('created_at')->date()->prefix('Created: '),
TextColumn::make('updated_at')->date()->prefix('Updated: '),
]),
])
->emptyStateHeading('No double player in details')
+19 -22
View File
@@ -22,37 +22,34 @@ class ImportDetails
$row = array_values($row);
// ss_player_id
// ss_team_id
// tx_team_id
// player_name
// ss_national_team_id
// birthdate
// height
// nationality
// position
// preferred_foot
// last_update
if ($row[1] != '') {
// 'ss_player_id',
// 'player_name',
// 'tx_team_id',
// 'ss_national_team_id',
// 'team_name',
// 'birthday',
// 'height',
// 'nationality',
// 'position',
// 'preferred_foot',
// 'last_update',
// 'created_at',
// 'updated_at',
StatistikoDetail::updateOrCreate(
[
'ss_player_id' => (int) $row[0],
],
[
'player_name' => $row[1],
'tx_team_id' => $row[2],
'ss_national_team_id' => $row[3],
'team_name' => $row[4],
'birthdate' => Carbon::parse($row[5])->toDateString(),
'height' => $row[6],
'ss_team_id' => (int) $row[1],
'tx_team_id' => (int) $row[2],
'player_name' => $row[3],
'ss_national_team_id' => (int) $row[4],
'birthdate' => Carbon::parse($row[5])->format('Y-m-d'),
'height' => (int) $row[6],
'nationality' => $row[7],
'position' => $row[8],
'preferred_foot' => $row[9],
'last_update' => Carbon::parse($row[10])->toDateString(),
'last_update' => Carbon::parse($row[10])->format('Y-m-d H:i:s'),
'created_at' => $now,
'updated_at' => $now,
]
+3 -4
View File
@@ -3,14 +3,13 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use MongoDB\Laravel\Eloquent\HybridRelations;
class SofaScorePlayerPosition extends Model
{
protected $primaryKey = 'ss_code';
use HybridRelations;
public $incrementing = false;
protected $keyType = 'string';
protected $connection = 'mariadb';
protected $fillable = [
'ss_code',
+6 -1
View File
@@ -3,13 +3,18 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use MongoDB\Laravel\Eloquent\HybridRelations;
class SofaScoreRosa extends Model
{
use HybridRelations;
protected $connection = 'mariadb';
protected $fillable = [
'sport_id',
'ss_team_id',
'ssteam_name',
'ss_team_name',
'ss_tournament_id',
'country_id',
'is_active',
+3
View File
@@ -3,9 +3,12 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use MongoDB\Laravel\Eloquent\HybridRelations;
class SofaScoreRosaTournament extends Model
{
use HybridRelations;
protected $fillable = [
'ss_team_id',
'ss_tournament_id',
+16 -13
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use MongoDB\Laravel\Eloquent\Model;
class StatistikoDetail extends Model
@@ -14,10 +15,11 @@ class StatistikoDetail extends Model
protected $fillable = [
'ss_player_id',
'ss_team_id',
'tx_team_id',
'player_name',
'ss_national_team_id',
'team_name',
'birthday',
'birthdate',
'height',
'nationality',
'position',
@@ -27,20 +29,21 @@ class StatistikoDetail extends Model
'updated_at',
];
protected function casts(): array
protected $casts = [
'last_update' => 'datetime',
];
// public function season()
// {
// return $this->hasMany(SofaScorePlayerPerSeason::class, 'ss_player_id', 'ss_player_id');
// }
public function team(): BelongsTo
{
return [
'birthdate' => 'date',
'last_update' => 'date',
];
return $this->belongsTo(SofaScoreRosa::class, 'ss_team_id', 'ss_team_id');
}
public function season()
{
return $this->hasMany(SofaScorePlayerPerSeason::class, 'ss_player_id', 'ss_player_id');
}
public function ss_code()
public function positions(): BelongsTo
{
return $this->belongsTo(SofaScorePlayerPosition::class, 'position', 'ss_code');
}
@@ -15,7 +15,8 @@ return new class extends Migration
{
Schema::create('details', function (Blueprint $collection) {
$collection->unique('ss_player_id');
$collection->index('player_name');
$collection->index('ss_team_id');
$collection->index('tx_team_id');
});
}
@@ -16,7 +16,7 @@ return new class extends Migration
$table->integer('sport_id')->index();
$table->integer('ss_team_id')->index();
$table->integer('country_id')->default(0)->nullable()->index()->references('id')->on('countries');
$table->string('ssteam_name');
$table->string('ss_team_name');
$table->boolean('is_active')->default(false);
$table->boolean('disabled')->default(false);
$table->boolean('grapped')->default(false);
@@ -12,6 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::create('sofa_score_player_positions', function (Blueprint $table) {
$table->id();
$table->string('ss_code')->index();
$table->string('name');
});