mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-19 17:20:30 +00:00
✨ **Add authenticated API endpoints for managing Meetups, Cities, Venues, and Lecturers**
- ➕ 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.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies\Concerns;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
trait ChecksCreatorOwnership
|
||||
{
|
||||
/**
|
||||
* Nur der urspruengliche Ersteller (created_by) oder ein Super-Admin darf das Model veraendern.
|
||||
*/
|
||||
protected function owns(User $user, Model $model): bool
|
||||
{
|
||||
return (int) $model->created_by === $user->id || $user->hasRole('super-admin');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user