diff --git a/composer.json b/composer.json index a55b1c3..a17f094 100644 --- a/composer.json +++ b/composer.json @@ -23,6 +23,10 @@ "ramsey/uuid": "^3.7|^4.0", "symfony/var-dumper": "^4.0|^5.0" }, + "require-dev": { + "laravel/framework": "^6.0|^7.0|^8.0", + "laravel/lumen-framework": "^6.0|^7.0|^8.0" + }, "conflict": { "andrey-helldar/laravel-support": "*" }, diff --git a/src/Facades/AppVersion.php b/src/Facades/AppVersion.php new file mode 100644 index 0000000..f08e7b0 --- /dev/null +++ b/src/Facades/AppVersion.php @@ -0,0 +1,21 @@ +major() === 6; + } + + public function is7x(): bool + { + return $this->major() === 7; + } + + public function is8x(): bool + { + return $this->major() === 8; + } + + protected function major(): int + { + return (int) Str::before($this->version(), '.'); + } + + protected function version(): string + { + if (AppHelper::isLumen()) { + $version = app()->version(); + + $version = Str::after($version, '('); + $version = Str::before($version, ')'); + + return $version; + } + + return Application::VERSION; + } +}