|
9 | 9 | use Statamic\Contracts\Entries\EntryRepository as EntryRepositoryContract; |
10 | 10 | use Statamic\Contracts\Forms\FormRepository as FormRepositoryContract; |
11 | 11 | use Statamic\Contracts\Globals\GlobalRepository as GlobalRepositoryContract; |
| 12 | +use Statamic\Contracts\Globals\GlobalVariablesRepository as GlobalVariablesRepositoryContract; |
12 | 13 | use Statamic\Contracts\Revisions\RevisionRepository as RevisionRepositoryContract; |
13 | 14 | use Statamic\Contracts\Structures\CollectionTreeRepository as CollectionTreeRepositoryContract; |
14 | 15 | use Statamic\Contracts\Structures\NavigationRepository as NavigationRepositoryContract; |
|
22 | 23 | use Statamic\Eloquent\Entries\EntryRepository; |
23 | 24 | use Statamic\Eloquent\Forms\FormRepository; |
24 | 25 | use Statamic\Eloquent\Globals\GlobalRepository; |
| 26 | +use Statamic\Eloquent\Globals\GlobalVariablesRepository; |
25 | 27 | use Statamic\Eloquent\Listeners\UpdateStructuredEntryOrder; |
26 | 28 | use Statamic\Eloquent\Revisions\RevisionRepository; |
27 | 29 | use Statamic\Eloquent\Structures\CollectionTreeRepository; |
@@ -127,6 +129,7 @@ public function register() |
127 | 129 | $this->registerEntries(); |
128 | 130 | $this->registerForms(); |
129 | 131 | $this->registerGlobals(); |
| 132 | + $this->registerGlobalVariables(); |
130 | 133 | $this->registerRevisions(); |
131 | 134 | $this->registerStructures(); |
132 | 135 | $this->registerStructureTrees(); |
@@ -280,9 +283,20 @@ private function registerGlobals() |
280 | 283 | $this->app->bind('statamic.eloquent.global_sets.model', function () { |
281 | 284 | return config('statamic.eloquent-driver.global_sets.model'); |
282 | 285 | }); |
| 286 | + } |
| 287 | + |
| 288 | + private function registerGlobalVariables() |
| 289 | + { |
| 290 | + $usingOldConfigKeys = config()->has('statamic.eloquent-driver.global_sets.variables_model'); |
| 291 | + |
| 292 | + if (config($usingOldConfigKeys ? 'statamic.eloquent-driver.global_sets.driver' : 'statamic.eloquent-driver.global_set_variables.driver', 'file') != 'eloquent') { |
| 293 | + return; |
| 294 | + } |
| 295 | + |
| 296 | + Statamic::repository(GlobalVariablesRepositoryContract::class, GlobalVariablesRepository::class); |
283 | 297 |
|
284 | | - $this->app->bind('statamic.eloquent.global_sets.variables_model', function () { |
285 | | - return config('statamic.eloquent-driver.global_sets.variables_model'); |
| 298 | + $this->app->bind('statamic.eloquent.global_set_variables.model', function () use ($usingOldConfigKeys) { |
| 299 | + return config($usingOldConfigKeys ? 'statamic.eloquent-driver.global_sets.variables_model' : 'statamic.eloquent-driver.global_set_variables.model'); |
286 | 300 | }); |
287 | 301 |
|
288 | 302 | Statamic::repository(GlobalRepositoryContract::class, GlobalRepository::class); |
|
0 commit comments