Add news article comments and reactions
This commit is contained in:
33
app/Models/NewsArticleCommentReaction.php
Normal file
33
app/Models/NewsArticleCommentReaction.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class NewsArticleCommentReaction extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'news_article_comment_reactions';
|
||||
|
||||
protected $fillable = ['comment_id', 'user_id', 'reaction'];
|
||||
|
||||
protected $casts = [
|
||||
'comment_id' => 'integer',
|
||||
'user_id' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function comment(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(NewsArticleComment::class, 'comment_id');
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user