<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Term extends Model
{
    protected $table = 'terms'; // テーブル名

    protected $primaryKey = 'terms_id'; // 主キー

    public $timestamps = true; // created_at / updated_at

    protected $fillable = [
        'city_id',
        'use_flag',
        'terms_revision',
        'terms_text',
        'memo',
        'start_date',
        'operator_id',
    ];

    protected $casts = [
        'start_date' => 'date',
        'use_flag' => 'boolean',
    ];

    /**
     * 利用規約のリストを取得
     */
    public static function getList()
    {
        return self::all();
    }
    public static function deleteByPk($ids)
    {
        if (!is_array($ids)) {
            $ids = [$ids];
        }
        return self::whereIn('terms_id', $ids)->delete();
    }
}
