mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-17 16:40:31 +00:00
1518611bdb
- ✨ Added `StoreCourseRequest` and `UpdateCourseRequest` for structured validation. - ✨ Introduced `StoreCourseEventRequest` and `UpdateCourseEventRequest` for consistent request validation. - 🖼️ Created `CourseResource` and `CourseEventResource` for API responses. - 🔄 Refactored `CourseController` and `CourseEventController` to use Policies and FormRequests. - ✨ Added dedicated `uploadLogo` and `uploadAvatar` API endpoints with shared media validation. - 🚀 Improved API by aligning Course and CourseEvent behavior with other entities.
42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Models\Lecturer;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/**
|
|
* @mixin Lecturer
|
|
*/
|
|
class LecturerResource extends JsonResource
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'name' => $this->name,
|
|
'slug' => $this->slug,
|
|
'subtitle' => $this->subtitle,
|
|
'intro' => $this->intro,
|
|
'description' => $this->description,
|
|
'active' => $this->active,
|
|
'website' => $this->website,
|
|
'twitter_username' => $this->twitter_username,
|
|
'nostr' => $this->nostr,
|
|
'lightning_address' => $this->lightning_address,
|
|
'lnurl' => $this->lnurl,
|
|
'node_id' => $this->node_id,
|
|
'paynym' => $this->paynym,
|
|
'team_id' => $this->team_id,
|
|
'avatar' => $this->getFirstMediaUrl('avatar', 'thumb'),
|
|
'created_by' => $this->created_by,
|
|
'created_at' => $this->created_at,
|
|
'updated_at' => $this->updated_at,
|
|
];
|
|
}
|
|
}
|