HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers95/rentman.io/app/Providers/AppServiceProvider.php
<?php

namespace App\Providers;

use App\Komma\SiteConfig\Models\SiteConfig;
use App\Komma\Sites\Kms\SiteService;
use App\Komma\Sites\SiteServiceInterface;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        if ($this->app->environment('local')) {
            $this->app->register('Barryvdh\Debugbar\ServiceProvider');
        }

        // You can use this to check if the modifier array isset and automatic call the atomic modifiers helper
        Blade::directive('modifiers', function ($expression) {
            // Strip single or dubble quotes
            $baseClass = str_replace('"', '', $expression);
            $baseClass = str_replace("'", '', $baseClass);

            // We echo the modifiers through the Modifiers helper
            // And we burn the defined modifiers

            return '<?php if(isset($modifiers)){ \Atomic::modifiers("'.$baseClass.'", $modifiers); } $modifiers = []; ?>';
        });

        // Check if we have the table for site config, so if the site used config
        if (\Schema::hasTable('site_config')) {
            // Try to get it out of the cache
            if (\Cache::has('siteConfig')) {
                $settings = \Cache::get('siteConfig');
            } else {
                $settings = SiteConfig::all();
                Log::info('Stored site settings in cache');
                \Cache::forever('siteConfig', $settings);
            }

            foreach ($settings as $setting) {
                \Config::set('site.'.$setting->key, $setting->value);
            }
        }
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton(SiteServiceInterface::class, SiteService::class);

        if ($this->app->environment('local', 'testing')) {
//            $this->app->register(\Laravel\Dusk\DuskServiceProvider::class); //Leave FQCN like it is
        }
    }
}