<?php

namespace Modules\Main\Models;

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

class Design extends Model
{
    use HasFactory;
    protected $table = 'design';
    protected $fillable = [
        'parameter',
        'value',
    ];

    public const parameters = [
        'title',
        'copyright',
        'phone',
        'phone_description',
        'logo',
        'page_color',
        'text_color',
        'primary_color',
        'secondary_color',
        'menu_btn_color',
        'menu_btn_hover_color',
        'menu_btn_text_color',
        'menu_btn_hover_text_color',
        'contact_form_count',
        'contact_form_count_max',
        'plan7_iframe',
        'enable_orders_module'
    ];

    public static function getParameters() {
        $parameters = [];
        foreach (Design::all() as $row) {
            $parameters[$row->parameter] = $row->value;
        }
        foreach (self::parameters as $parameter) {
            if (!array_key_exists($parameter, $parameters)) {
                //$parameters[$parameter] = null;
            }
        }
        return $parameters;
    }

}
