mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Add DirectMessage model
This commit is contained in:
parent
f82024d2f8
commit
0fba6e16a7
1 changed files with 29 additions and 0 deletions
29
app/DirectMessage.php
Normal file
29
app/DirectMessage.php
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Auth;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class DirectMessage extends Model
|
||||||
|
{
|
||||||
|
public function status()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Status::class, 'id', 'status_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function url()
|
||||||
|
{
|
||||||
|
return url('/i/message/' . $this->to_id . '/' . $this->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function author()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Profile::class, 'id', 'from_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function me()
|
||||||
|
{
|
||||||
|
return Auth::user()->profile->id === $this->from_id;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue