1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-22 07:42:41 +00:00
pixelfed/app/DirectMessage.php

35 lines
639 B
PHP
Raw Normal View History

2018-10-17 18:21:39 +00:00
<?php
namespace App;
use Auth;
use Illuminate\Database\Eloquent\Model;
class DirectMessage extends Model
{
public function status()
{
2020-11-25 17:41:44 +00:00
return $this->belongsTo(Status::class, 'status_id', 'id');
2018-10-17 18:21:39 +00:00
}
public function url()
{
2020-11-18 21:19:02 +00:00
return config('app.url') . '/account/direct/m/' . $this->status_id;
2018-10-17 18:21:39 +00:00
}
public function author()
{
2020-11-25 17:41:44 +00:00
return $this->belongsTo(Profile::class, 'from_id', 'id');
2018-10-17 18:21:39 +00:00
}
2020-11-18 21:19:02 +00:00
public function recipient()
{
2020-11-25 17:41:44 +00:00
return $this->belongsTo(Profile::class, 'to_id', 'id');
2020-11-18 21:19:02 +00:00
}
2018-10-17 18:21:39 +00:00
public function me()
{
return Auth::user()->profile->id === $this->from_id;
}
}