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,16 +3,31 @@
namespace App; namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class Contact extends Model class Contact extends Model
{ {
protected $casts = [
'responded_at' => 'datetime',
];
public function user() public function user()
{ {
return $this->belongsTo(User::class); return $this->belongsTo(User::class);
} }
public function adminUrl() 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'));
} }
} }