You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Comment on a data table
|
|
|
|
*/
|
|
|
|
class TableComment extends Model
|
|
|
|
{
|
|
|
|
/** Context data table */
|
|
|
|
public function table()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Table::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Parent comment (that we reply to; can be null) */
|
|
|
|
public function ancestor()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(TableComment::class, 'ancestor_id');
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Replies to this comment */
|
|
|
|
public function replies()
|
|
|
|
{
|
|
|
|
return $this->hasMany(TableComment::class, 'ancestor_id');
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Authoring user */
|
|
|
|
public function author()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(User::class, 'author_id');
|
|
|
|
}
|
|
|
|
}
|