Fix BindingResolutionError when debug toolbar isn't present (#465)

* Fix BindingResolutionError when debug toolbar isn't present

* Formatting
This commit is contained in:
Nabeel S
2019-12-11 15:12:31 -05:00
committed by GitHub
parent e6d38f9338
commit a58bca390b
8 changed files with 67 additions and 21 deletions

View File

@@ -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;

View File

@@ -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) {
}
}
}

View File

@@ -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

View File

@@ -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