<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class CompanySetting extends Model
{
    use HasFactory;

    protected $fillable = [
        'company_name', 'tagline', 'address', 'phone', 'email',
        'website', 'logo_path', 'tax_id', 'currency', 'currency_code',
        'timezone', 'date_format', 'fiscal_year_start',
    ];

    public static function current(): self
    {
        $setting = self::first();
        if (! $setting) {
            $setting = self::create([
                'company_name' => 'ABC YARN HOUSE',
                'currency'     => '৳',
                'currency_code'=> 'BDT',
            ]);
        }
        return $setting;
    }
}
