2019-06-06 04:31:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2024-10-10 07:53:16 +00:00
|
|
|
use Illuminate\Support\Str;
|
2019-06-06 04:31:25 +00:00
|
|
|
|
|
|
|
class Contact extends Model
|
|
|
|
{
|
2024-10-10 07:53:16 +00:00
|
|
|
protected $casts = [
|
|
|
|
'responded_at' => 'datetime',
|
|
|
|
];
|
|
|
|
|
2019-06-06 04:31:25 +00:00
|
|
|
public function user()
|
|
|
|
{
|
2024-10-10 07:53:16 +00:00
|
|
|
return $this->belongsTo(User::class);
|
2019-06-06 04:31:25 +00:00
|
|
|
}
|
2019-06-07 03:13:32 +00:00
|
|
|
|
|
|
|
public function adminUrl()
|
|
|
|
{
|
2024-10-10 07:53:16 +00:00
|
|
|
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'));
|
2019-06-07 03:13:32 +00:00
|
|
|
}
|
2019-06-06 04:31:25 +00:00
|
|
|
}
|