datatable.directory codebase
https://datatable.directory/
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.
42 lines
856 B
42 lines
856 B
6 years ago
|
<?php
|
||
|
|
||
|
namespace App\Models;
|
||
|
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
||
|
/**
|
||
|
* Comment on a data table
|
||
|
*/
|
||
|
class TableComment extends Model
|
||
|
{
|
||
|
/** Context data table */
|
||
|
public function dataTable()
|
||
|
{
|
||
|
return $this->belongsTo(DataTable::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');
|
||
|
}
|
||
|
|
||
|
/** Reports of this comment */
|
||
|
public function reportsOf()
|
||
|
{
|
||
|
return $this->morphMany(ContentReport::class, 'object');
|
||
|
}
|
||
|
}
|