@@ -7,26 +7,26 @@ |
||
| 7 | 7 | |
| 8 | 8 | class FrequencyDistributionExpressionFactory |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * Create a new trend expression instance. |
|
| 12 | - * |
|
| 13 | - * @param \Illuminate\Database\Eloquent\Builder $query |
|
| 14 | - * @param string $column |
|
| 15 | - * @param int $stepSize |
|
| 16 | - * |
|
| 17 | - * @return \Laravel\Nova\Metrics\FrequencyDistributionExpression |
|
| 18 | - */ |
|
| 19 | - public static function make(Builder $query, $column, $stepSize) |
|
| 20 | - { |
|
| 21 | - switch ($query->getConnection()->getDriverName()) { |
|
| 22 | - case 'sqlite': |
|
| 23 | - return new SqliteFrequencyDistributionExpression($query, $column, $stepSize); |
|
| 24 | - case 'mysql': |
|
| 25 | - return new MySqlFrequencyDistributionExpression($query, $column, $stepSize); |
|
| 26 | - case 'pgsql': |
|
| 27 | - return new PostgresFrequencyDistributionExpression($query, $column, $stepSize); |
|
| 28 | - default: |
|
| 29 | - throw new InvalidArgumentException('Bar chart metric helpers are not supported for this database.'); |
|
| 30 | - } |
|
| 31 | - } |
|
| 10 | + /** |
|
| 11 | + * Create a new trend expression instance. |
|
| 12 | + * |
|
| 13 | + * @param \Illuminate\Database\Eloquent\Builder $query |
|
| 14 | + * @param string $column |
|
| 15 | + * @param int $stepSize |
|
| 16 | + * |
|
| 17 | + * @return \Laravel\Nova\Metrics\FrequencyDistributionExpression |
|
| 18 | + */ |
|
| 19 | + public static function make(Builder $query, $column, $stepSize) |
|
| 20 | + { |
|
| 21 | + switch ($query->getConnection()->getDriverName()) { |
|
| 22 | + case 'sqlite': |
|
| 23 | + return new SqliteFrequencyDistributionExpression($query, $column, $stepSize); |
|
| 24 | + case 'mysql': |
|
| 25 | + return new MySqlFrequencyDistributionExpression($query, $column, $stepSize); |
|
| 26 | + case 'pgsql': |
|
| 27 | + return new PostgresFrequencyDistributionExpression($query, $column, $stepSize); |
|
| 28 | + default: |
|
| 29 | + throw new InvalidArgumentException('Bar chart metric helpers are not supported for this database.'); |
|
| 30 | + } |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -6,24 +6,24 @@ |
||
| 6 | 6 | |
| 7 | 7 | abstract class BarChartMetric extends Partition |
| 8 | 8 | { |
| 9 | - use HasFrequencyDistributions; |
|
| 9 | + use HasFrequencyDistributions; |
|
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * The element's component. |
|
| 13 | - * |
|
| 14 | - * @var string |
|
| 15 | - */ |
|
| 16 | - public $component = 'bar-chart-metric'; |
|
| 11 | + /** |
|
| 12 | + * The element's component. |
|
| 13 | + * |
|
| 14 | + * @var string |
|
| 15 | + */ |
|
| 16 | + public $component = 'bar-chart-metric'; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Create a new partition metric result. |
|
| 20 | - * |
|
| 21 | - * @param array $value |
|
| 22 | - * |
|
| 23 | - * @return \Insenseanalytics\NovaBarMetrics\BarChartMetricResult |
|
| 24 | - */ |
|
| 25 | - public function result(array $value) |
|
| 26 | - { |
|
| 27 | - return new BarChartMetricResult($value); |
|
| 28 | - } |
|
| 18 | + /** |
|
| 19 | + * Create a new partition metric result. |
|
| 20 | + * |
|
| 21 | + * @param array $value |
|
| 22 | + * |
|
| 23 | + * @return \Insenseanalytics\NovaBarMetrics\BarChartMetricResult |
|
| 24 | + */ |
|
| 25 | + public function result(array $value) |
|
| 26 | + { |
|
| 27 | + return new BarChartMetricResult($value); |
|
| 28 | + } |
|
| 29 | 29 | } |
@@ -9,37 +9,37 @@ |
||
| 9 | 9 | |
| 10 | 10 | class NovaBarMetricsServiceProvider extends ServiceProvider |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * Bootstrap any application services. |
|
| 14 | - */ |
|
| 15 | - public function boot() |
|
| 16 | - { |
|
| 17 | - Nova::serving(function (ServingNova $event) { |
|
| 18 | - Nova::script('nova-bar-metrics', __DIR__ . '/../dist/js/nova-bar-metrics.js'); |
|
| 19 | - // Nova::style('nova-bar-metrics', __DIR__ . '/../dist/css/nova-bar-metrics.css'); |
|
| 20 | - }); |
|
| 12 | + /** |
|
| 13 | + * Bootstrap any application services. |
|
| 14 | + */ |
|
| 15 | + public function boot() |
|
| 16 | + { |
|
| 17 | + Nova::serving(function (ServingNova $event) { |
|
| 18 | + Nova::script('nova-bar-metrics', __DIR__ . '/../dist/js/nova-bar-metrics.js'); |
|
| 19 | + // Nova::style('nova-bar-metrics', __DIR__ . '/../dist/css/nova-bar-metrics.css'); |
|
| 20 | + }); |
|
| 21 | 21 | |
| 22 | 22 | $this->bootCommands(); |
| 23 | - } |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Register any application services. |
|
| 27 | - */ |
|
| 28 | - public function register() |
|
| 29 | - { |
|
| 30 | - } |
|
| 25 | + /** |
|
| 26 | + * Register any application services. |
|
| 27 | + */ |
|
| 28 | + public function register() |
|
| 29 | + { |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Boot the custom commands |
|
| 34 | - * |
|
| 35 | - * @return void |
|
| 36 | - */ |
|
| 37 | - private function bootCommands() |
|
| 38 | - { |
|
| 32 | + /** |
|
| 33 | + * Boot the custom commands |
|
| 34 | + * |
|
| 35 | + * @return void |
|
| 36 | + */ |
|
| 37 | + private function bootCommands() |
|
| 38 | + { |
|
| 39 | 39 | if ($this->app->runningInConsole()) { |
| 40 | - $this->commands([ |
|
| 40 | + $this->commands([ |
|
| 41 | 41 | BarMetricCommand::class, |
| 42 | - ]); |
|
| 42 | + ]); |
|
| 43 | + } |
|
| 43 | 44 | } |
| 44 | - } |
|
| 45 | 45 | } |