add field project_id to label
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Has been cancelled
Details
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Has been cancelled
Details
This commit is contained in:
parent
474a2ae4e1
commit
8969b67af8
|
@ -4,6 +4,7 @@ namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
|
||||||
class Label extends Model
|
class Label extends Model
|
||||||
{
|
{
|
||||||
|
@ -15,4 +16,9 @@ class Label extends Model
|
||||||
'department_id',
|
'department_id',
|
||||||
'created_by_id',
|
'created_by_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function tasks(): BelongsToMany
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Task::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ class LabelFactory extends Factory
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => fake()->name(),
|
'name' => fake()->name(),
|
||||||
|
'project_id' => 1,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ return new class extends Migration
|
||||||
Schema::create('labels', function (Blueprint $table) {
|
Schema::create('labels', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name', 255);
|
$table->string('name', 255);
|
||||||
|
$table->foreignId('project_id')->constrained('projects');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,18 +14,22 @@ class LabelSeeder extends Seeder
|
||||||
DB::table('labels')->insert([
|
DB::table('labels')->insert([
|
||||||
[
|
[
|
||||||
'name' => 'ошибка',
|
'name' => 'ошибка',
|
||||||
|
'project_id' => 1,
|
||||||
'created_at' => Carbon::now(),
|
'created_at' => Carbon::now(),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'документация',
|
'name' => 'документация',
|
||||||
|
'project_id' => 1,
|
||||||
'created_at' => Carbon::now(),
|
'created_at' => Carbon::now(),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'дубликат',
|
'name' => 'дубликат',
|
||||||
|
'project_id' => 1,
|
||||||
'created_at' => Carbon::now(),
|
'created_at' => Carbon::now(),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'доработка',
|
'name' => 'доработка',
|
||||||
|
'project_id' => 1,
|
||||||
'created_at' => Carbon::now(),
|
'created_at' => Carbon::now(),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in New Issue