Add leader management functionality for Meetups

-  Introduced `leaders`, `promoteLeader`, and `demoteLeader` methods in `Meetup` model for consistent handling of meetup leadership.
- ⚙️ Refactored `MeetupLeaderController` to use new leadership methods, improving reusability and maintainability.
- 👮‍♂️ Added `ValidNpub` validation rule for npub input standardization.
- 🧪 Added feature tests for leadership delegation and permissions.
- 🖼️ Implemented leader management UI in meetup edit page with flash messaging for actions.
This commit is contained in:
HolgerHatGarKeineNode
2026-06-16 23:11:24 +02:00
parent 9f8fda294a
commit ffcee850ca
6 changed files with 289 additions and 27 deletions
@@ -2,9 +2,8 @@
namespace App\Http\Requests\Api;
use Closure;
use App\Rules\ValidNpub;
use Illuminate\Foundation\Http\FormRequest;
use swentel\nostr\Key\Key as NostrKey;
/**
* Setzt einen weiteren Leader für ein Meetup per Nostr-npub ein. Nur ein
@@ -24,18 +23,7 @@ class StoreMeetupLeaderRequest extends FormRequest
public function rules(): array
{
return [
'npub' => [
'required',
'string',
'starts_with:npub1',
function (string $attribute, mixed $value, Closure $fail): void {
try {
(new NostrKey)->convertToHex((string) $value);
} catch (\Throwable) {
$fail(__('Das ist kein gültiger npub.'));
}
},
],
'npub' => ['required', 'string', new ValidNpub],
];
}
}