Skip to content

Commit 8e6df38

Browse files
author
Admin
committed
Changes for config:cache
1 parent c1ce60e commit 8e6df38

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

config/laravel_crud_wizard.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
return [
4+
'LIVE_MODE' => \env('LIVE_MODE'),
5+
];

src/Helpers/GeneralHelper.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ public static function app(mixed $abstract = null, array $parameters = []): mixe
5454

5555
public static function isDebug(): bool
5656
{
57-
return \env('LIVE_MODE') === false && \function_exists('request') && null !== \request('sqlDebug');
57+
return \function_exists('config')
58+
&& \config('laravel_crud_wizard.LIVE_MODE') === false
59+
&& \function_exists('request')
60+
&& null !== \request('sqlDebug');
5861
}
5962
}

src/Models/BaseModel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ public function getColumns(bool $includingPrimary = true): array
7979
\array_diff($this->fillable, \array_diff([$this->primaryKey], $this->fillable));
8080

8181
if (
82-
\env('LIVE_MODE') === false
82+
\function_exists('config')
83+
&& \config('laravel_crud_wizard.LIVE_MODE') === false
8384
&& [] !== $reservedUsed = \array_intersect(
8485
['page', 'limit', 'cursor', 'simplePaginate', 'sort', 'sqlDebug', 'logError'],
8586
$columns

src/Providers/CrudProvider.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,22 @@ class CrudProvider extends ServiceProvider
1414
/**
1515
* Register any application services.
1616
*/
17-
public function register()
17+
public function register(): void
1818
{
19+
$this->mergeConfigFrom(__DIR__ . '/../../config/laravel_crud_wizard.php', 'laravel_crud_wizard');
1920
}
2021

2122
/**
2223
* Bootstrap any application services.
2324
*/
2425
public function boot(): void
2526
{
27+
$this->publishes([
28+
__DIR__ . '/../../config/laravel_crud_wizard.php' => \function_exists('config_path') ?
29+
\config_path('laravel_crud_wizard.php') :
30+
\base_path('config/laravel_crud_wizard.php')
31+
], 'config');
32+
2633
EloquentBuilder::macro(
2734
'createHydrated',
2835
/**

0 commit comments

Comments
 (0)