Files
zh-chat-server/app/Models/Comment.php
2022-11-01 11:07:41 +08:00

23 lines
392 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class Comment extends Model
{
use SoftDeletes;
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function parent(): BelongsTo
{
return $this->belongsTo(__CLASS__, 'parent_id');
}
}