mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-27 00:33:17 +00:00
29 lines
516 B
PHP
29 lines
516 B
PHP
<?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;
|
|
}
|
|
}
|