36 lines
651 B
PHP
36 lines
651 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class PostComment extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'post_comments';
|
|
|
|
protected $fillable = [
|
|
'post_id',
|
|
'user_id',
|
|
'body',
|
|
'is_highlighted',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_highlighted' => 'boolean',
|
|
];
|
|
|
|
public function post(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Post::class);
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|