Add customer contact inquiry system, automated receipt emails, admin communication inbox, and customer profile management

This commit is contained in:
2026-11-02 09:56:24 +01:00
parent 387241f971
commit 9fd39bd7d6
28 changed files with 2426 additions and 8 deletions
+58
View File
@@ -0,0 +1,58 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Communication extends Model
{
use HasFactory;
protected $fillable = [
'user_id',
'order_id',
'name',
'email',
'phone',
'subject',
'message',
'status',
'admin_notes',
'ip_address',
'user_agent',
'last_replied_at',
];
protected $casts = [
'last_replied_at' => 'datetime',
];
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function order(): BelongsTo
{
return $this->belongsTo(Order::class);
}
public function replies(): HasMany
{
return $this->hasMany(CommunicationReply::class)->oldest();
}
public function getStatusLabelAttribute(): string
{
return match ($this->status) {
'new' => 'Nieuw',
'in_progress' => 'In behandeling',
'resolved' => 'Beantwoord',
'closed' => 'Gesloten',
default => ucfirst($this->status),
};
}
}