mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-11 02:50:29 +00:00
3b93e22e95
- ➕ Introduced `store`, `update`, `mine`, and `mineShow` endpoints for `Meetups`, `Cities`, `Venues`, and `Lecturers` with validation and authorization. - 🔒 Added `Policies` for `Meetups`, `Cities`, `Venues`, and `Lecturers` leveraging `ChecksCreatorOwnership` for ownership checks. - 🌐 Created `Resources` for structured API responses: `MeetupResource`, `CityResource`, `VenueResource`, and `LecturerResource`. - ✅ Added dedicated `Request` classes for input validation: `Store` and `Update` variants for all models. - 🛠️ Updated controllers to support new functionalities with localized error messages and proper HTTP responses.
46 lines
1.5 KiB
PHP
46 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Api;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateLecturerRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user()->can('update', $this->route('lecturer'));
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array<int, string>>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => ['sometimes', 'required', 'string', 'max:255'],
|
|
'subtitle' => ['sometimes', 'nullable', 'string'],
|
|
'intro' => ['sometimes', 'nullable', 'string'],
|
|
'description' => ['sometimes', 'nullable', 'string'],
|
|
'active' => ['sometimes', 'boolean'],
|
|
'website' => ['sometimes', 'nullable', 'url', 'max:255'],
|
|
'twitter_username' => ['sometimes', 'nullable', 'string', 'max:255'],
|
|
'nostr' => ['sometimes', 'nullable', 'string', 'max:255'],
|
|
'lightning_address' => ['sometimes', 'nullable', 'string', 'max:255'],
|
|
'lnurl' => ['sometimes', 'nullable', 'string'],
|
|
'node_id' => ['sometimes', 'nullable', 'string', 'max:255'],
|
|
'paynym' => ['sometimes', 'nullable', 'string'],
|
|
'team_id' => ['sometimes', 'nullable', 'integer', 'exists:teams,id'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'team_id.exists' => 'Das angegebene Team existiert nicht.',
|
|
];
|
|
}
|
|
}
|