<?php

namespace App\Models\Movie;

use Illuminate\Database\Eloquent\Model;
use App\Http\Traits\PagingTrait;

class MovieBlame extends Model
{
    use PagingTrait;

    protected $table = 'tb_movie_blame';
    protected $primaryKey = 'id';

    public $keyType = 'int';
    public $incrementing = true;
    public $timestamps = true;

    const CREATED_AT = 'created_at';
    const UPDATED_AT = 'updated_at';
    const DELETED_AT = null;

    protected $guarded = [];

    /**
     * 신고 등록했는지
     */
    public function isAlready(string $movieCd, int $reviewID, int $userID): bool
    {
        return $this->where([
            ['id', $reviewID],
            ['movie_cd', $movieCd],
            ['user_id', $userID]
        ])->exists();
    }
}
