Add organization setting employees_can_see_billable_rates

This commit is contained in:
Constantin Graf
2024-10-01 18:14:26 +02:00
committed by Constantin Graf
parent 9d279d4980
commit 51cd919db6
13 changed files with 269 additions and 15 deletions

View File

@@ -11,6 +11,7 @@ use App\Models\Project;
use App\Models\ProjectMember;
use App\Service\ColorService;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
/**
* @extends Factory<Project>
@@ -46,12 +47,21 @@ class ProjectFactory extends Factory
});
}
public function billable(): self
public function billable(?int $billableRate = null): self
{
return $this->state(function (array $attributes): array {
return $this->state(function (array $attributes) use ($billableRate): array {
return [
'is_billable' => true,
'billable_rate' => $this->faker->numberBetween(50, 1000) * 100,
'billable_rate' => $billableRate === null ? $this->faker->numberBetween(50, 1000) * 100 : $billableRate,
];
});
}
public function createdAt(Carbon $createdAt): self
{
return $this->state(function (array $attributes) use ($createdAt): array {
return [
'created_at' => $createdAt,
];
});
}