added status for todos; updated add todo dialog title
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-09-18 15:34:35 -07:00
parent 1e8ae3d1e5
commit 4391d342ff
6 changed files with 269 additions and 5 deletions
+12
View File
@@ -5,6 +5,7 @@ namespace Database\Factories;
use App\Models\Folder;
use App\Models\Todo;
use App\Models\User;
use App\TodoStatus;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
@@ -23,6 +24,7 @@ class TodoFactory extends Factory
'user_id' => User::factory(),
'folder_id' => Folder::factory(),
'description' => fake()->sentence(6),
'status' => TodoStatus::Open,
'due_date' => today()->addDays(5),
'completed_at' => null,
];
@@ -58,6 +60,16 @@ class TodoFactory extends Factory
]);
}
/**
* Apply the given status to the todo.
*/
public function withStatus(TodoStatus $status): static
{
return $this->state(fn (array $attributes) => [
'status' => $status,
]);
}
/**
* Indicate that the todo is overdue.
*/
@@ -0,0 +1,28 @@
<?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::table('todos', function (Blueprint $table) {
$table->string('status')->default('open')->after('description');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('todos', function (Blueprint $table) {
$table->dropColumn('status');
});
}
};