2025-07-23 15:41:01 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models\Boards;
|
|
|
|
|
|
2025-11-06 17:45:49 +09:00
|
|
|
use App\Models\Members\User;
|
2025-07-23 15:41:01 +09:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
|
|
2025-08-21 09:50:15 +09:00
|
|
|
/**
|
|
|
|
|
* @mixin IdeHelperBoardComment
|
|
|
|
|
*/
|
2025-07-23 15:41:01 +09:00
|
|
|
class BoardComment extends Model
|
|
|
|
|
{
|
|
|
|
|
use SoftDeletes;
|
|
|
|
|
|
|
|
|
|
protected $table = 'board_comments';
|
2025-11-06 17:45:49 +09:00
|
|
|
|
2025-07-23 15:41:01 +09:00
|
|
|
protected $fillable = [
|
2025-11-06 17:45:49 +09:00
|
|
|
'post_id', 'tenant_id', 'user_id', 'parent_id', 'content', 'ip_address', 'status',
|
2025-07-23 15:41:01 +09:00
|
|
|
];
|
|
|
|
|
|
2025-11-06 17:45:49 +09:00
|
|
|
public function post()
|
|
|
|
|
{
|
2025-07-23 15:41:01 +09:00
|
|
|
return $this->belongsTo(Post::class, 'post_id');
|
|
|
|
|
}
|
2025-11-06 17:45:49 +09:00
|
|
|
|
|
|
|
|
public function user()
|
|
|
|
|
{
|
2025-07-23 15:41:01 +09:00
|
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
|
|
|
}
|
2025-11-06 17:45:49 +09:00
|
|
|
|
|
|
|
|
public function parent()
|
|
|
|
|
{
|
2025-07-23 15:41:01 +09:00
|
|
|
return $this->belongsTo(BoardComment::class, 'parent_id');
|
|
|
|
|
}
|
2025-11-06 17:45:49 +09:00
|
|
|
|
|
|
|
|
public function children()
|
|
|
|
|
{
|
2025-07-23 15:41:01 +09:00
|
|
|
return $this->hasMany(BoardComment::class, 'parent_id')->where('status', 'active');
|
|
|
|
|
}
|
|
|
|
|
}
|