Fix BindingResolutionError when debug toolbar isn't present (#465)
* Fix BindingResolutionError when debug toolbar isn't present * Formatting
This commit is contained in:
@@ -50,6 +50,7 @@ class Version extends Command
|
||||
}
|
||||
}
|
||||
|
||||
// Always write out the build ID/build number which is the commit hash
|
||||
$build_number = $this->versionSvc->getBuildId($cfg);
|
||||
$cfg['current']['commit'] = $build_number;
|
||||
$cfg['build']['number'] = $build_number;
|
||||
|
||||
@@ -25,6 +25,7 @@ use App\Models\Subfleet;
|
||||
use App\Models\User;
|
||||
use App\Repositories\SettingRepository;
|
||||
use App\Services\ModuleService;
|
||||
use Illuminate\Contracts\Container\BindingResolutionException;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
@@ -75,10 +76,13 @@ class AppServiceProvider extends ServiceProvider
|
||||
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
|
||||
}
|
||||
|
||||
if (config('app.debug_toolbar') === true) {
|
||||
app('debugbar')->enable();
|
||||
} else {
|
||||
app('debugbar')->disable();
|
||||
try {
|
||||
if (config('app.debug_toolbar') === true) {
|
||||
app('debugbar')->enable();
|
||||
} else {
|
||||
app('debugbar')->disable();
|
||||
}
|
||||
} catch (BindingResolutionException $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,6 +185,8 @@ class VersionService extends Service
|
||||
$current_version = $this->cleanVersionString($current_version);
|
||||
}
|
||||
|
||||
// Replace "dev" with "alpha", since
|
||||
|
||||
$latest_version = $this->getLatestVersion();
|
||||
|
||||
// Convert to semver
|
||||
|
||||
@@ -4,6 +4,18 @@ use App\Exceptions\SettingNotFound;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
|
||||
/*
|
||||
* array_key_first only exists in PHP 7.3+
|
||||
*/
|
||||
if (!function_exists('array_key_first')) {
|
||||
function array_key_first(array $arr)
|
||||
{
|
||||
foreach ($arr as $key => $unused) {
|
||||
return $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('in_mask')) {
|
||||
/**
|
||||
* Return true/false if a value exists in a mask
|
||||
|
||||
Reference in New Issue
Block a user