File: D:/HostingSpaces/SBogers10/rentman2019.komma.pro/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
}
}
}