|
@@ -77,9 +77,11 @@ class InstallCommand extends Command
|
|
|
$this->line('<info>Admin directory was created:</info> '.str_replace(base_path(), '', $this->directory));
|
|
$this->line('<info>Admin directory was created:</info> '.str_replace(base_path(), '', $this->directory));
|
|
|
|
|
|
|
|
$this->makeDir('Controllers');
|
|
$this->makeDir('Controllers');
|
|
|
|
|
+ $this->makeDir('Metrics/Examples');
|
|
|
|
|
|
|
|
$this->createHomeController();
|
|
$this->createHomeController();
|
|
|
$this->createAuthController();
|
|
$this->createAuthController();
|
|
|
|
|
+ $this->createMetricCards();
|
|
|
|
|
|
|
|
$this->createBootstrapFile();
|
|
$this->createBootstrapFile();
|
|
|
$this->createRoutesFile();
|
|
$this->createRoutesFile();
|
|
@@ -114,11 +116,52 @@ class InstallCommand extends Command
|
|
|
|
|
|
|
|
$this->laravel['files']->put(
|
|
$this->laravel['files']->put(
|
|
|
$authController,
|
|
$authController,
|
|
|
- str_replace('DummyNamespace', config('admin.route.namespace'), $contents)
|
|
|
|
|
|
|
+ str_replace(
|
|
|
|
|
+ ['DummyNamespace', 'MetricsNamespace'],
|
|
|
|
|
+ [$this->namespace('Controllers'), $this->namespace('Metrics\\Examples')],
|
|
|
|
|
+ $contents
|
|
|
|
|
+ )
|
|
|
);
|
|
);
|
|
|
$this->line('<info>AuthController file was created:</info> '.str_replace(base_path(), '', $authController));
|
|
$this->line('<info>AuthController file was created:</info> '.str_replace(base_path(), '', $authController));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ */
|
|
|
|
|
+ public function createMetricCards()
|
|
|
|
|
+ {
|
|
|
|
|
+ $map = [
|
|
|
|
|
+ '/Metrics/Examples/NewUsers.php' => 'metrics/NewUsers',
|
|
|
|
|
+ '/Metrics/Examples/NewDevices.php' => 'metrics/NewDevices',
|
|
|
|
|
+ '/Metrics/Examples/ProductOrders.php' => 'metrics/ProductOrders',
|
|
|
|
|
+ '/Metrics/Examples/Sessions.php' => 'metrics/Sessions',
|
|
|
|
|
+ '/Metrics/Examples/Tickets.php' => 'metrics/Tickets',
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ $namespace = $this->namespace('Metrics\\Examples');
|
|
|
|
|
+
|
|
|
|
|
+ foreach ($map as $path => $stub) {
|
|
|
|
|
+ $this->laravel['files']->put(
|
|
|
|
|
+ $this->directory.$path,
|
|
|
|
|
+ str_replace(
|
|
|
|
|
+ 'DummyNamespace',
|
|
|
|
|
+ $namespace,
|
|
|
|
|
+ $this->getStub($stub)
|
|
|
|
|
+ )
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param string $name
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return string
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function namespace($name = null)
|
|
|
|
|
+ {
|
|
|
|
|
+ return trim(str_replace('/', '\\', $this->directory), '\\').($name ? "\\{$name}" : '');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Create routes file.
|
|
* Create routes file.
|
|
|
*
|
|
*
|