mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-17 04:30:31 +00:00
ffcee850ca
- ➕ 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.
30 lines
732 B
PHP
30 lines
732 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Api;
|
|
|
|
use App\Rules\ValidNpub;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
/**
|
|
* Setzt einen weiteren Leader für ein Meetup per Nostr-npub ein. Nur ein
|
|
* bestehender Leader (bzw. Ersteller/Super-Admin) darf das (manageLeaders).
|
|
* Der npub muss ein gültiger bech32-kodierter öffentlicher Schlüssel sein.
|
|
*/
|
|
class StoreMeetupLeaderRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user()->can('manageLeaders', $this->route('meetup'));
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array<int, mixed>>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'npub' => ['required', 'string', new ValidNpub],
|
|
];
|
|
}
|
|
}
|