File tree Expand file tree Collapse file tree 3 files changed +71
-0
lines changed Expand file tree Collapse file tree 3 files changed +71
-0
lines changed Original file line number Diff line number Diff line change 2323 "ramsey/uuid" : " ^3.7|^4.0" ,
2424 "symfony/var-dumper" : " ^4.0|^5.0"
2525 },
26+ "require-dev" : {
27+ "laravel/framework" : " ^6.0|^7.0|^8.0" ,
28+ "laravel/lumen-framework" : " ^6.0|^7.0|^8.0"
29+ },
2630 "conflict" : {
2731 "andrey-helldar/laravel-support" : " *"
2832 },
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace DragonCode \LaravelSupport \Facades ;
6+
7+ use DragonCode \LaravelSupport \Support \AppVersion as Support ;
8+ use Illuminate \Support \Facades \Facade ;
9+
10+ /**
11+ * @method static bool is6x()
12+ * @method static bool is7x()
13+ * @method static bool is8x()
14+ */
15+ class AppVersion extends Facade
16+ {
17+ protected static function getFacadeAccessor (): string
18+ {
19+ return Support::class;
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace DragonCode \LaravelSupport \Support ;
6+
7+ use DragonCode \LaravelSupport \Facades \App as AppHelper ;
8+ use Illuminate \Foundation \Application ;
9+ use Illuminate \Support \Str ;
10+
11+ class AppVersion
12+ {
13+ public function is6x (): bool
14+ {
15+ return $ this ->major () === 6 ;
16+ }
17+
18+ public function is7x (): bool
19+ {
20+ return $ this ->major () === 7 ;
21+ }
22+
23+ public function is8x (): bool
24+ {
25+ return $ this ->major () === 8 ;
26+ }
27+
28+ protected function major (): int
29+ {
30+ return (int ) Str::before ($ this ->version (), '. ' );
31+ }
32+
33+ protected function version (): string
34+ {
35+ if (AppHelper::isLumen ()) {
36+ $ version = app ()->version ();
37+
38+ $ version = Str::after ($ version , '( ' );
39+ $ version = Str::before ($ version , ') ' );
40+
41+ return $ version ;
42+ }
43+
44+ return Application::VERSION ;
45+ }
46+ }
You can’t perform that action at this time.
0 commit comments