refactor: align codebase with EventCrew domain and trim legacy band stack
- Update API: events, users, policies, routes, resources, migrations - Remove deprecated models/resources (customers, setlists, invitations, etc.) - Refresh admin app and docs; remove apps/band Made-with: Cursor
This commit is contained in:
@@ -4,100 +4,32 @@ declare(strict_types=1);
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\EventStatus;
|
||||
use App\Enums\EventVisibility;
|
||||
use App\Models\Customer;
|
||||
use App\Models\Event;
|
||||
use App\Models\Location;
|
||||
use App\Models\User;
|
||||
use App\Models\Organisation;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<Event>
|
||||
*/
|
||||
/** @extends Factory<Event> */
|
||||
final class EventFactory extends Factory
|
||||
{
|
||||
protected $model = Event::class;
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
public function definition(): array
|
||||
{
|
||||
$startTime = fake()->time('H:i');
|
||||
$endTime = fake()->optional()->time('H:i');
|
||||
$name = fake()->unique()->words(3, true);
|
||||
$startDate = fake()->dateTimeBetween('+1 week', '+3 months');
|
||||
|
||||
return [
|
||||
'title' => fake()->sentence(3),
|
||||
'description' => fake()->optional()->paragraph(),
|
||||
'event_date' => fake()->dateTimeBetween('+1 week', '+6 months'),
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
'fee' => fake()->optional()->randomFloat(2, 100, 5000),
|
||||
'currency' => 'EUR',
|
||||
'status' => fake()->randomElement(EventStatus::cases()),
|
||||
'visibility' => EventVisibility::Members,
|
||||
'notes' => fake()->optional()->paragraph(),
|
||||
'created_by' => User::factory(),
|
||||
'organisation_id' => Organisation::factory(),
|
||||
'name' => ucfirst($name),
|
||||
'slug' => str($name)->slug()->toString(),
|
||||
'start_date' => $startDate,
|
||||
'end_date' => fake()->dateTimeBetween($startDate, (clone $startDate)->modify('+3 days')),
|
||||
'timezone' => 'Europe/Amsterdam',
|
||||
'status' => 'draft',
|
||||
];
|
||||
}
|
||||
|
||||
public function draft(): static
|
||||
public function published(): static
|
||||
{
|
||||
return $this->state(fn () => ['status' => EventStatus::Draft]);
|
||||
}
|
||||
|
||||
public function pending(): static
|
||||
{
|
||||
return $this->state(fn () => ['status' => EventStatus::Pending]);
|
||||
}
|
||||
|
||||
public function confirmed(): static
|
||||
{
|
||||
return $this->state(fn () => ['status' => EventStatus::Confirmed]);
|
||||
}
|
||||
|
||||
public function completed(): static
|
||||
{
|
||||
return $this->state(fn () => ['status' => EventStatus::Completed]);
|
||||
}
|
||||
|
||||
public function cancelled(): static
|
||||
{
|
||||
return $this->state(fn () => ['status' => EventStatus::Cancelled]);
|
||||
}
|
||||
|
||||
public function withLocation(): static
|
||||
{
|
||||
return $this->state(fn () => ['location_id' => Location::factory()]);
|
||||
}
|
||||
|
||||
public function withCustomer(): static
|
||||
{
|
||||
return $this->state(fn () => ['customer_id' => Customer::factory()]);
|
||||
}
|
||||
|
||||
public function upcoming(): static
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'event_date' => fake()->dateTimeBetween('+1 day', '+1 month'),
|
||||
'status' => EventStatus::Confirmed,
|
||||
]);
|
||||
}
|
||||
|
||||
public function past(): static
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'event_date' => fake()->dateTimeBetween('-6 months', '-1 day'),
|
||||
'status' => EventStatus::Completed,
|
||||
]);
|
||||
}
|
||||
|
||||
public function privateEvent(): static
|
||||
{
|
||||
return $this->state(fn () => ['visibility' => EventVisibility::Private]);
|
||||
}
|
||||
|
||||
public function publicEvent(): static
|
||||
{
|
||||
return $this->state(fn () => ['visibility' => EventVisibility::Public]);
|
||||
return $this->state(fn () => ['status' => 'published']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user