✨ 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:
44
api/app/Models/Testimonial.php
Normal file
44
api/app/Models/Testimonial.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\HasTranslations;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Testimonial extends Model
|
||||
{
|
||||
use HasTranslations;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'role',
|
||||
'company',
|
||||
'avatar',
|
||||
'text_key',
|
||||
'personality',
|
||||
'project_id',
|
||||
'display_order',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
public function project(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Project::class);
|
||||
}
|
||||
|
||||
public function scopeActive(Builder $query): Builder
|
||||
{
|
||||
return $query->where('is_active', true);
|
||||
}
|
||||
|
||||
public function scopeOrdered(Builder $query): Builder
|
||||
{
|
||||
return $query->orderBy('display_order');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user