Your IP : 216.73.216.79


Current Path : /var/www/html/dynaweb-starter/plugin/dynaweb-theme/src/Repositories/
Upload File :
Current File : /var/www/html/dynaweb-starter/plugin/dynaweb-theme/src/Repositories/ThemeSettingsRepository.php

<?php

namespace Dynaweb\DynawebTheme\Repositories;

class ThemeSettingsRepository extends BaseRepository
{
    /***
     * Load Setting
     */
    public function loadSetting()
    {
        $records = $this->model::all();

        $property = [];
        foreach ($records as $r) {
            $property[$r->property] = $r->value;
        }

        return $property;
    }

    /***
     * Save property
     */
    public function saveProperty(array $states)
    {
        foreach ($states as $key => $state) {

            if(!empty($state)) {
                $this->model::updateOrCreate(
                    [
                        'property' => $key
                    ],
                    [
                        'content' => $state,
                        'value' => $state,
                        'type' => 'string',
                        'status' => 1
                    ],
                );
            }
        }
    }

    /***
     * Get title
     */
    public function getTitle()
    {
        return $this->model::title()?->first()->value;
    }

    /***
     * Get Primary Color
     */
    public function getPrimaryColor()
    {
        return $this->model::primaryColor()->first()?->value;
    }

    /***
     * Get Success Color
     */
    public function getSuccessColor()
    {
        return $this->model::successColor()->first()?->value;
    }

    /***
     * Get Success Color
     */
    public function getWarningColor()
    {
        return $this->model::warningColor()->first()?->value;
    }

    /***
    * Get Success Color
    */
    public function getInfoColor()
    {
        return $this->model::infoColor()->first()?->value;
    }

    /***
    * Get Success Color
    */
    public function getGrayColor()
    {
        return $this->model::grayColor()->first()?->value;
    }

    /***
     * Get Danger Color
     */
    public function getDangerColor()
    {
        return $this->model::dangerColor()->first()?->value;
    }
}