]> _ Git - cubist_cms-back.git/commitdiff
wip #3753
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 3 Dec 2020 12:51:10 +0000 (13:51 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 3 Dec 2020 12:51:10 +0000 (13:51 +0100)
src/CookieServiceProvider.php [deleted file]
src/CubistBackpackServiceProvider.php [deleted file]
src/app/CookieServiceProvider.php [new file with mode: 0644]
src/app/CubistBackpackServiceProvider.php [new file with mode: 0644]

diff --git a/src/CookieServiceProvider.php b/src/CookieServiceProvider.php
deleted file mode 100644 (file)
index f35d554..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-namespace Cubist\Backpack;
-
-use Illuminate\Cookie\CookieJar;
-use Illuminate\Cookie\CookieServiceProvider as Base;
-
-class CookieServiceProvider extends Base
-{
-    public function register()
-    {
-        $this->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 (file)
index e5934fa..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-
-namespace Cubist\Backpack;
-
-use Cubist\Backpack\Console\Commands\MigrateCommand;
-use Cubist\Backpack\Console\Commands\GenerateCommand;
-use Cubist\Backpack\Console\Commands\InstallCommand;
-use Cubist\Backpack\Console\Commands\LocaleCopy;
-use Cubist\Backpack\Console\Commands\LocaleSlugReset;
-use Cubist\Backpack\Console\Commands\SearchIndexCommand;
-use Cubist\Backpack\Console\Commands\UpdateCommand;
-use Illuminate\Support\Facades\Blade;
-use Illuminate\Support\ServiceProvider;
-use Cubist\Backpack\CubistCrudPanel;
-
-class CubistBackpackServiceProvider extends ServiceProvider
-{
-    /**
-     * Indicates if loading of the provider is deferred.
-     *
-     * @var bool
-     */
-    protected $defer = false;
-
-    const NAMESPACE = 'cubist_back';
-
-
-    /**
-     * Perform post-registration booting of services.
-     *
-     * @return void
-     */
-    public function boot()
-    {
-        $resourcesDir = __DIR__ . '/../resources';
-
-        $this->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 "<?php echo \$__env->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 (file)
index 0000000..f35d554
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+
+namespace Cubist\Backpack;
+
+use Illuminate\Cookie\CookieJar;
+use Illuminate\Cookie\CookieServiceProvider as Base;
+
+class CookieServiceProvider extends Base
+{
+    public function register()
+    {
+        $this->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 (file)
index 0000000..94ba457
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+
+namespace Cubist\Backpack;
+
+use Cubist\Backpack\Console\Commands\MigrateCommand;
+use Cubist\Backpack\Console\Commands\GenerateCommand;
+use Cubist\Backpack\Console\Commands\InstallCommand;
+use Cubist\Backpack\Console\Commands\LocaleCopy;
+use Cubist\Backpack\Console\Commands\LocaleSlugReset;
+use Cubist\Backpack\Console\Commands\SearchIndexCommand;
+use Cubist\Backpack\Console\Commands\UpdateCommand;
+use Illuminate\Support\Facades\Blade;
+use Illuminate\Support\ServiceProvider;
+
+class CubistBackpackServiceProvider extends ServiceProvider
+{
+    /**
+     * Indicates if loading of the provider is deferred.
+     *
+     * @var bool
+     */
+    protected $defer = false;
+
+    const NAMESPACE = 'cubist_back';
+
+
+    /**
+     * Perform post-registration booting of services.
+     *
+     * @return void
+     */
+    public function boot()
+    {
+        $resourcesDir = __DIR__ . '/../resources';
+
+        $this->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 "<?php echo \$__env->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
+        ]);
+    }
+}