File tree Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ laravel: '@testbench'
22
33providers :
44 - DragonCode\LaravelFeed\LaravelFeedServiceProvider
5+ - Workbench\App\Providers\WorkbenchServiceProvider
56
67migrations :
78 - workbench/database/migrations
Original file line number Diff line number Diff line change 44
55namespace Workbench \App \Providers ;
66
7+ use Illuminate \Config \Repository ;
8+ use Illuminate \Foundation \Application ;
9+ use Illuminate \Support \Collection ;
710use Illuminate \Support \ServiceProvider ;
11+ use Illuminate \Support \Str ;
812
913class WorkbenchServiceProvider extends ServiceProvider
1014{
11- /**
12- * Register services.
13- */
14- public function register (): void
15+ public function boot (): void
1516 {
16- //
17+ if ($ this ->isFreshLaravel ()) {
18+ return ;
19+ }
20+
21+ Repository::macro ('collection ' , function (string $ key ) {
22+ return new Collection ($ this ->get ($ key ));
23+ });
1724 }
1825
19- /**
20- * Bootstrap services.
21- */
22- public function boot (): void
26+ protected function isFreshLaravel (): bool
2327 {
24- //
28+ return Str:: of (Application:: VERSION )-> before ( ' . ' )-> toString () === ' 12 ' ;
2529 }
2630}
You can’t perform that action at this time.
0 commit comments