mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 00:02:15 +01:00
Added ability to archive projects and clients, fixes ST-37
This commit is contained in:
committed by
Gregor Vostrak
parent
f21a2d4bdd
commit
a69d1cb4c4
@@ -22,6 +22,7 @@ class ClientFactory extends Factory
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->company(),
|
||||
'archived_at' => null,
|
||||
'organization_id' => Organization::factory(),
|
||||
];
|
||||
}
|
||||
@@ -43,4 +44,13 @@ class ClientFactory extends Factory
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
public function archived(): self
|
||||
{
|
||||
return $this->state(function (array $attributes): array {
|
||||
return [
|
||||
'archived_at' => $this->faker->dateTime(),
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class ProjectFactory extends Factory
|
||||
'is_billable' => false,
|
||||
'billable_rate' => null,
|
||||
'is_public' => false,
|
||||
'archived_at' => null,
|
||||
'client_id' => null,
|
||||
'organization_id' => Organization::factory(),
|
||||
];
|
||||
@@ -45,6 +46,15 @@ class ProjectFactory extends Factory
|
||||
});
|
||||
}
|
||||
|
||||
public function archived(): self
|
||||
{
|
||||
return $this->state(function (array $attributes): array {
|
||||
return [
|
||||
'archived_at' => $this->faker->dateTime(),
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
public function forOrganization(Organization $organization): self
|
||||
{
|
||||
return $this->state(function (array $attributes) use ($organization): array {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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('projects', function (Blueprint $table): void {
|
||||
$table->dateTime('archived_at')->nullable();
|
||||
});
|
||||
Schema::table('clients', function (Blueprint $table): void {
|
||||
$table->dateTime('archived_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('projects', function (Blueprint $table): void {
|
||||
$table->dropColumn('archived_at');
|
||||
});
|
||||
Schema::table('clients', function (Blueprint $table): void {
|
||||
$table->dropColumn('archived_at');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user