✨ Add testimonials page with personality-styled cards (Story 2.6)
- Add testimonials table migration with personality enum - Create Testimonial model with HasTranslations trait - Add TestimonialSeeder with 4 test testimonials - Create TestimonialController and TestimonialResource - Add useFetchTestimonials composable - Create TestimonialCard component with personality-based styling - Add temoignages.vue page with loading/error states - Add testimonials translations in FR/EN Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
30
api/app/Http/Resources/TestimonialResource.php
Normal file
30
api/app/Http/Resources/TestimonialResource.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class TestimonialResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'role' => $this->role,
|
||||
'company' => $this->company,
|
||||
'avatar' => $this->avatar,
|
||||
'text' => $this->getTranslated('text_key'),
|
||||
'personality' => $this->personality,
|
||||
'display_order' => $this->display_order,
|
||||
'project' => $this->whenLoaded('project', function () {
|
||||
return $this->project ? [
|
||||
'id' => $this->project->id,
|
||||
'slug' => $this->project->slug,
|
||||
'title' => $this->project->getTranslated('title_key'),
|
||||
] : null;
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user