Files
exchange-2.0/app/Models/Remark.php
T
2024-07-23 22:58:36 +08:00

36 lines
666 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Remark extends AbstractModel
{
use SoftDeletes;
protected $table = 'remarks';
protected $fillable = [
'owner_id',
'owner_type',
'commenter_id',
'content',
'type'
];
public function owner(): morphTo
{
return $this->morphTo();
}
/**
* @return BelongsTo
*/
public function commenter(): BelongsTo
{
return $this->BelongsTo(User::class, 'commenter_id', 'id');
}
}