mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 00:02:15 +01:00
Migrated endpoints from user to member; Renamed membership to member
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Member;
|
||||
use App\Models\Organization;
|
||||
use App\Models\Project;
|
||||
use App\Models\Tag;
|
||||
@@ -34,6 +35,7 @@ class TimeEntryFactory extends Factory
|
||||
'billable' => $this->faker->boolean(),
|
||||
'tags' => [],
|
||||
'user_id' => User::factory(),
|
||||
'member_id' => Member::factory(),
|
||||
'task_id' => null,
|
||||
'project_id' => null,
|
||||
'organization_id' => Organization::factory(),
|
||||
@@ -86,6 +88,9 @@ class TimeEntryFactory extends Factory
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use forMember instead
|
||||
*/
|
||||
public function forUser(User $user): self
|
||||
{
|
||||
return $this->state(function (array $attributes) use ($user) {
|
||||
@@ -95,6 +100,17 @@ class TimeEntryFactory extends Factory
|
||||
});
|
||||
}
|
||||
|
||||
public function forMember(Member $member): static
|
||||
{
|
||||
return $this->state(function (array $attributes) use ($member): array {
|
||||
return [
|
||||
'member_id' => $member->getKey(),
|
||||
'user_id' => $member->user_id,
|
||||
'organization_id' => $member->organization_id,
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
public function forOrganization(Organization $organization): self
|
||||
{
|
||||
return $this->state(function (array $attributes) use ($organization) {
|
||||
|
||||
Reference in New Issue
Block a user