From: Vincent Vanwaelscappel Date: Thu, 3 Dec 2020 12:51:10 +0000 (+0100) Subject: wip #3753 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=2e6bd2b09ab32cb99d9d88f390dce34a0528bbca;p=cubist_cms-back.git wip #3753 --- diff --git a/src/CookieServiceProvider.php b/src/CookieServiceProvider.php deleted file mode 100644 index f35d554..0000000 --- a/src/CookieServiceProvider.php +++ /dev/null @@ -1,39 +0,0 @@ -app->singleton('cookie', function ($app) { - $config = $app->make('config')->get('session'); - - $domains = explode(',', $config['domain']); - - if (count($domains) === 1) { - $domain = $domains[0]; - } else { - foreach ($domains as $domain) { - if (stripos($_SERVER['HTTP_HOST'], $domain) !== false) { - $found = $domain; - break; - } - } - if (!isset($found)) { - $domain = $_SERVER['HTTP_HOST']; - } else { - $domain = $found; - } - } - config(['session.domain' => $domain]); - - return (new CookieJar)->setDefaultPathAndDomain( - $config['path'], $domain, $config['secure'], $config['same_site'] ?? null - ); - }); - } -} diff --git a/src/CubistBackpackServiceProvider.php b/src/CubistBackpackServiceProvider.php deleted file mode 100644 index e5934fa..0000000 --- a/src/CubistBackpackServiceProvider.php +++ /dev/null @@ -1,85 +0,0 @@ -loadTranslationsFrom(realpath(__DIR__ . '/resources/lang'), self::NAMESPACE); - foreach (glob(__DIR__ . '/routes/cubist/backpack/*.php') as $filename) { - $this->loadRoutesFrom($filename); - } - $this->publishes([$resourcesDir . '/config/cubist.php' => config_path('cubist.php')], 'config'); - $this->loadViewsFrom(realpath(__DIR__ . '/resources/views'), self::NAMESPACE); - - Blade::directive('vendor_asset', function ($path) { - return vendor_asset($path); - }); - - Blade::directive('favicon', function () { - return "make('" . self::NAMESPACE . "::favicon', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"; - }); - - - $this->app->extend('crud', function () { - return new CubistCrudPanel(); - }); - } - - - /** - * Register any package services. - * - * @return void - */ - public function register() - { - $resourcesDir = __DIR__ . '/resources'; - - $configs = ['app', 'cubist']; - - foreach ($configs as $config) { - $this->mergeConfigFrom($resourcesDir . '/config/' . $config . '.php', $config); - } - - - $this->commands([ - InstallCommand::class, - UpdateCommand::class, - GenerateCommand::class, - MigrateCommand::class, - SearchIndexCommand::class, - LocaleCopy::class, - LocaleSlugReset::class - ]); - } -} diff --git a/src/app/CookieServiceProvider.php b/src/app/CookieServiceProvider.php new file mode 100644 index 0000000..f35d554 --- /dev/null +++ b/src/app/CookieServiceProvider.php @@ -0,0 +1,39 @@ +app->singleton('cookie', function ($app) { + $config = $app->make('config')->get('session'); + + $domains = explode(',', $config['domain']); + + if (count($domains) === 1) { + $domain = $domains[0]; + } else { + foreach ($domains as $domain) { + if (stripos($_SERVER['HTTP_HOST'], $domain) !== false) { + $found = $domain; + break; + } + } + if (!isset($found)) { + $domain = $_SERVER['HTTP_HOST']; + } else { + $domain = $found; + } + } + config(['session.domain' => $domain]); + + return (new CookieJar)->setDefaultPathAndDomain( + $config['path'], $domain, $config['secure'], $config['same_site'] ?? null + ); + }); + } +} diff --git a/src/app/CubistBackpackServiceProvider.php b/src/app/CubistBackpackServiceProvider.php new file mode 100644 index 0000000..94ba457 --- /dev/null +++ b/src/app/CubistBackpackServiceProvider.php @@ -0,0 +1,84 @@ +loadTranslationsFrom(realpath(__DIR__ . '/resources/lang'), self::NAMESPACE); + foreach (glob(__DIR__ . '/routes/cubist/backpack/*.php') as $filename) { + $this->loadRoutesFrom($filename); + } + $this->publishes([$resourcesDir . '/config/cubist.php' => config_path('cubist.php')], 'config'); + $this->loadViewsFrom(realpath(__DIR__ . '/resources/views'), self::NAMESPACE); + + Blade::directive('vendor_asset', function ($path) { + return vendor_asset($path); + }); + + Blade::directive('favicon', function () { + return "make('" . self::NAMESPACE . "::favicon', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"; + }); + + + $this->app->extend('crud', function () { + return new CubistCrudPanel(); + }); + } + + + /** + * Register any package services. + * + * @return void + */ + public function register() + { + $resourcesDir = __DIR__ . '/resources'; + + $configs = ['app', 'cubist']; + + foreach ($configs as $config) { + $this->mergeConfigFrom($resourcesDir . '/config/' . $config . '.php', $config); + } + + + $this->commands([ + InstallCommand::class, + UpdateCommand::class, + GenerateCommand::class, + MigrateCommand::class, + SearchIndexCommand::class, + LocaleCopy::class, + LocaleSlugReset::class + ]); + } +}