mirror of https://github.com/pixelfed/pixelfed
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
768 B
PHTML
36 lines
768 B
PHTML
|
8 years ago
|
<?php
|
||
|
|
|
||
|
4 weeks ago
|
namespace App\Models;
|
||
|
8 years ago
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
4 weeks ago
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
4 weeks ago
|
use Illuminate\Support\Facades\Auth;
|
||
|
8 years ago
|
|
||
|
|
class DirectMessage extends Model
|
||
|
|
{
|
||
|
4 weeks ago
|
public function status(): BelongsTo
|
||
|
8 years ago
|
{
|
||
|
9 months ago
|
return $this->belongsTo(Status::class, 'status_id', 'id');
|
||
|
8 years ago
|
}
|
||
|
|
|
||
|
|
public function url()
|
||
|
|
{
|
||
|
9 months ago
|
return config('app.url').'/account/direct/m/'.$this->status_id;
|
||
|
8 years ago
|
}
|
||
|
|
|
||
|
4 weeks ago
|
public function author(): BelongsTo
|
||
|
8 years ago
|
{
|
||
|
9 months ago
|
return $this->belongsTo(Profile::class, 'from_id', 'id');
|
||
|
8 years ago
|
}
|
||
|
|
|
||
|
4 weeks ago
|
public function recipient(): BelongsTo
|
||
|
6 years ago
|
{
|
||
|
6 years ago
|
return $this->belongsTo(Profile::class, 'to_id', 'id');
|
||
|
6 years ago
|
}
|
||
|
|
|
||
|
8 years ago
|
public function me()
|
||
|
|
{
|
||
|
9 months ago
|
return Auth::user()->profile->id === $this->from_id;
|
||
|
8 years ago
|
}
|
||
|
|
}
|