Skip to content

Commit 4d2d516

Browse files
Merge pull request #1479 from liberu-genealogy/copilot/fix-relationship-model-error
Fix: Add team relationship to ImportJob for Filament multi-tenant support
2 parents 2b23ac6 + 919e6d3 commit 4d2d516

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

app/Models/ImportJob.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
namespace App\Models;
44

5+
use App\Traits\BelongsToTenant;
56
use Illuminate\Database\Eloquent\Factories\HasFactory;
67

78
class ImportJob extends \FamilyTree365\LaravelGedcom\Models\ImportJob
89
{
10+
use BelongsToTenant;
911
use HasFactory;
1012

1113
/**
@@ -14,6 +16,7 @@ class ImportJob extends \FamilyTree365\LaravelGedcom\Models\ImportJob
1416
* @var list<string>
1517
*/
1618
protected $fillable = [
19+
'team_id',
1720
'user_id',
1821
'slug',
1922
'status',
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class () extends Migration {
8+
public function up(): void
9+
{
10+
Schema::table('importjobs', function (Blueprint $table) {
11+
$table->foreignId('team_id')->nullable()->constrained('teams')->nullOnDelete()->after('user_id');
12+
});
13+
}
14+
15+
public function down(): void
16+
{
17+
Schema::table('importjobs', function (Blueprint $table) {
18+
$table->dropForeignIdFor(\App\Models\Team::class);
19+
$table->dropColumn('team_id');
20+
});
21+
}
22+
};

0 commit comments

Comments
 (0)