mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-11 14:50:30 +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.
37 lines
797 B
PHP
37 lines
797 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Api;
|
|
|
|
use App\Models\Venue;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreVenueRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user()->can('create', Venue::class);
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array<int, string>>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'city_id' => ['required', 'integer', 'exists:cities,id'],
|
|
'name' => ['required', 'string', 'max:255'],
|
|
'street' => ['required', 'string', 'max:255'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'city_id.exists' => 'Die angegebene Stadt existiert nicht.',
|
|
];
|
|
}
|
|
}
|