From 11da5605b23dcd41561beda21118004257fee64e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 10 Oct 2024 01:53:16 -0600 Subject: [PATCH] Update Contact model --- app/Contact.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/app/Contact.php b/app/Contact.php index 4d9bc56e8..2239af7d8 100644 --- a/app/Contact.php +++ b/app/Contact.php @@ -3,16 +3,31 @@ namespace App; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Str; class Contact extends Model { + protected $casts = [ + 'responded_at' => 'datetime', + ]; + public function user() { - return $this->belongsTo(User::class); + return $this->belongsTo(User::class); } public function adminUrl() { - return url('/i/admin/messages/show/' . $this->id); + return url('/i/admin/messages/show/'.$this->id); + } + + public function userResponseUrl() + { + return url('/i/contact-admin-response/'.$this->id); + } + + public function getMessageId() + { + return $this->id.'-'.(string) Str::uuid().'@'.strtolower(config('pixelfed.domain.app', 'example.org')); } }