mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-05-18 20:34:52 +00:00
71a4898303
- Added `is_active` and `last_event_at` fields to meetups with migration. - Enhanced UI: Display `Aktiv`/`Inaktiv` badges and last event dates across dashboard, tables, and maps. - Introduced `/meetups:update-activity` command to manage activity flags and timestamps. - Validated latitude/longitude to prevent `0,0` inputs in city creation and updates. - Updated factories and tests to include meetup activity states (`active`, `inactive`).
62 lines
1.8 KiB
PHP
62 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\City;
|
|
use App\Models\Meetup;
|
|
use App\Models\User;
|
|
use Database\Factories\Helpers\NostrHelper;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
/**
|
|
* @extends Factory<Meetup>
|
|
*/
|
|
class MeetupFactory extends Factory
|
|
{
|
|
protected $model = Meetup::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
$cityName = fake()->city();
|
|
$name = 'Bitcoin Meetup '.$cityName;
|
|
|
|
return [
|
|
'city_id' => City::factory(),
|
|
'name' => $name.' '.fake()->unique()->numberBetween(1, 99999),
|
|
'slug' => Str::slug($name).'-'.fake()->unique()->numberBetween(1000, 99999),
|
|
'intro' => fake()->paragraph(),
|
|
'telegram_link' => 'https://t.me/'.Str::slug($cityName).'_btc',
|
|
'webpage' => 'https://'.Str::slug($cityName).'.einundzwanzig.space',
|
|
'twitter_username' => fake()->boolean(40) ? '@btc_'.Str::slug($cityName) : null,
|
|
'github_data' => [],
|
|
'matrix_group' => null,
|
|
'community' => fake()->boolean(80) ? 'einundzwanzig' : null,
|
|
'visible_on_map' => true,
|
|
'simplex' => null,
|
|
'signal' => null,
|
|
'nostr' => NostrHelper::randomNpub(),
|
|
'nostr_status' => NostrHelper::fakeNostrEventStatus(),
|
|
'created_by' => User::factory(),
|
|
'is_active' => false,
|
|
'last_event_at' => null,
|
|
];
|
|
}
|
|
|
|
public function active(): static
|
|
{
|
|
return $this->state(fn (array $attrs) => [
|
|
'is_active' => true,
|
|
'last_event_at' => now()->subDays(30),
|
|
]);
|
|
}
|
|
|
|
public function inactive(): static
|
|
{
|
|
return $this->state(fn (array $attrs) => [
|
|
'is_active' => false,
|
|
'last_event_at' => now()->subYears(2),
|
|
]);
|
|
}
|
|
}
|