Update Contact model

This commit is contained in:
Daniel Supernault 2024-10-10 01:53:16 -06:00
parent 7820b506d8
commit 11da5605b2
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -3,9 +3,14 @@
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);
@ -13,6 +18,16 @@ class Contact extends Model
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'));
}
}