Implement board columns and project workflow settings

This commit is contained in:
2026-03-25 01:16:09 +01:00
parent 840d01f6fc
commit 3f9b83ec16
17 changed files with 895 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace Database\Factories;
use App\Models\BoardColumn;
use App\Models\Project;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<BoardColumn>
*/
class BoardColumnFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->unique()->words(2, true),
'position' => 1,
'project_id' => Project::factory(),
];
}
}
@@ -0,0 +1,32 @@
<?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('board_columns', function (Blueprint $table) {
$table->id();
$table->foreignId('project_id')->constrained()->cascadeOnDelete();
$table->string('name');
$table->unsignedInteger('position');
$table->timestamps();
$table->unique(['project_id', 'position']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('board_columns');
}
};
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace Database\Seeders;
use App\Models\BoardColumn;
use App\Models\Project;
use Illuminate\Database\Seeder;
class BoardColumnSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
Project::query()
->orderBy('id')
->get()
->each(function (Project $project): void {
BoardColumn::factory()
->count(3)
->sequence(
['name' => 'Todo', 'position' => 1],
['name' => 'In Progress', 'position' => 2],
['name' => 'Done', 'position' => 3],
)
->for($project)
->create();
});
}
}
+1
View File
@@ -15,6 +15,7 @@ class DatabaseSeeder extends Seeder
$this->call([
UserSeeder::class,
ProjectSeeder::class,
BoardColumnSeeder::class,
TeamSeeder::class,
ProjectAccessSeeder::class,
]);