<?php

namespace App\Traits;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Schema;

trait ChecksTableExistence
{
    protected static function model(): Model
    {
        return new static();
    }

    public static function tableExists(): bool
    {
        return Schema::hasTable(static::model()->getTable());
    }

    public static function isInstalled(): bool
    {
        return static::tableExists();
    }

    public static function isNotInstalled(): bool
    {
        return !static::tableExists();
    }
}
