This commit is contained in:
salam committed 2026-01-12 05:28:42 +01:00
1 parent b31f3ec005
commit 31a0ccdf3b
6 files changed
+60 -1

No files matched your search

@@ -6,6 +6,7 @@ use App\Console\Commands\Nuh;
use App\Console\Commands\Xml;
use App\Models\CompetitionGroup;
use App\Models\Element;
use App\Models\ElementGroup;
use App\Models\Event;
use App\Models\Group;
use App\Models\Sport;
@@ -100,15 +101,27 @@ class Fixtures
$element = [
'name' => (string) $row->hteam,
'sport_id' => (int) $sport_id,
'country_id' => (int) $row->group['cnid'],
];
Element::updateOrCreate(['id' => (int) $row->hteam['id']], $element);
$element_group = [
'competition_group_id' => (int) $row->group['cgid'],
];
ElementGroup::updateOrCreate(['element_id' => (int) $row->hteam['id'], 'group_id' => (int) $row->group['id']], $element_group);
$element = [
'name' => (string) $row->ateam,
'sport_id' => (int) $sport_id,
'country_id' => (int) $row->group['cnid'],
];
Element::updateOrCreate(['id' => (int) $row->ateam['id']], $element);
$element_group = [
'competition_group_id' => (int) $row->group['cgid'],
];
ElementGroup::updateOrCreate(['element_id' => (int) $row->ateam['id'], 'group_id' => (int) $row->group['id']], $element_group);
if ($sport_id == 1) {
$total_soccer++;
} else {
+1
View File
@@ -10,6 +10,7 @@ class Element extends Model
'id',
'name',
'sport_id',
'country_id',
];
public function sport()
+14
View File
@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ElementGroup extends Model
{
protected $fillable = [
'element_id',
'group_id',
'competition_group_id',
];
}
@@ -26,7 +26,7 @@ return new class extends Migration
$table->dateTime('starttime')->nullable();
$table->integer('sport_id')->index()->references('id')->on('sports');
$table->integer('country_id')->default(0)->nullable()->index()->references('id')->on('countries');
$table->integer('group_id')->default(0)->nullable()->index();
$table->integer('group_id')->default(0)->nullable()->index()->references('id')->on('groups');
$table->integer('competition_group_id')->default(0)->nullable()->index()->references('id')->on('competition_groups');
$table->integer('home_id')->default(0)->nullable()->index()->references('id')->on('elements');
$table->integer('away_id')->default(0)->nullable()->index()->references('id')->on('elements');
@@ -15,6 +15,7 @@ return new class extends Migration
$table->id();
$table->string('name');
$table->integer('sport_id')->index()->references('id')->on('sports');
$table->integer('country_id')->default(0)->nullable()->index()->references('id')->on('countries');
$table->timestamps();
});
}
@@ -0,0 +1,30 @@
<?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('element_groups', function (Blueprint $table) {
$table->id();
$table->integer('element_id')->default(0)->nullable()->index()->references('id')->on('elements');
$table->integer('competition_group_id')->default(0)->nullable()->index()->references('id')->on('competition_groups');
$table->integer('group_id')->default(0)->nullable()->index()->references('id')->on('groups');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('element_groups');
}
};