mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-13 02:32:15 +01:00
Add ability to set task to done, fixes ST-244
This commit is contained in:
committed by
Gregor Vostrak
parent
75e739f6fb
commit
364168debd
@@ -25,6 +25,7 @@ class TaskFactory extends Factory
|
||||
'name' => $this->faker->word(),
|
||||
'project_id' => Project::factory(),
|
||||
'organization_id' => Organization::factory(),
|
||||
'done_at' => null,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -37,6 +38,15 @@ class TaskFactory extends Factory
|
||||
});
|
||||
}
|
||||
|
||||
public function isDone(): self
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'done_at' => $this->faker->dateTime('now', 'UTC'),
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
public function forOrganization(Organization $organization): self
|
||||
{
|
||||
return $this->state(function (array $attributes) use ($organization) {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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('tasks', function (Blueprint $table): void {
|
||||
$table->dateTime('done_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('tasks', function (Blueprint $table): void {
|
||||
$table->dropColumn('done_at');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user