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.
pixelfed/app/Models/DirectMessage.php

36 lines
768 B
PHTML

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Facades\Auth;
class DirectMessage extends Model
{
public function status(): BelongsTo
{
9 months ago
return $this->belongsTo(Status::class, 'status_id', 'id');
}
public function url()
{
9 months ago
return config('app.url').'/account/direct/m/'.$this->status_id;
}
public function author(): BelongsTo
{
9 months ago
return $this->belongsTo(Profile::class, 'from_id', 'id');
}
public function recipient(): BelongsTo
{
return $this->belongsTo(Profile::class, 'to_id', 'id');
}
public function me()
{
9 months ago
return Auth::user()->profile->id === $this->from_id;
}
}