File size: 660B
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class CommentVote extends Model
{
use HasFactory;
protected $guarded= ['id'];
public function scopeRead()
{
return $this->where("read","=",0);
}
public function comment(): BelongsTo
{
return $this->belongsTo(Comment::class);
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function comment_votes()
{
return $this->hasMany(CommentVote::class);
}
}