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\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Label extends Model
|
||||
{
|
||||
|
@ -15,4 +16,9 @@ class Label extends Model
|
|||
'department_id',
|
||||
'created_by_id',
|
||||
];
|
||||
|
||||
public function tasks(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Task::class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ class LabelFactory extends Factory
|
|||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'project_id' => 1,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ return new class extends Migration
|
|||
Schema::create('labels', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 255);
|
||||
$table->foreignId('project_id')->constrained('projects');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -14,18 +14,22 @@ class LabelSeeder extends Seeder
|
|||
DB::table('labels')->insert([
|
||||
[
|
||||
'name' => 'ошибка',
|
||||
'project_id' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'документация',
|
||||
'project_id' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'дубликат',
|
||||
'project_id' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'доработка',
|
||||
'project_id' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
],
|
||||
]);
|
||||
|
|
Loading…
Reference in New Issue