File tree Expand file tree Collapse file tree 3 files changed +18
-9
lines changed
Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -78,16 +78,19 @@ private function usingDefaultRepositories(Closure $callback): void
7878
7979 private function importCollections (): void
8080 {
81- $ this ->withProgressBar (CollectionFacade::all (), function ($ collection ) {
82- if ($ this ->shouldImportCollections ()) {
81+ $ importCollections = $ this ->shouldImportCollections ();
82+ $ importCollectionTrees = $ this ->shouldImportCollectionTrees ();
83+
84+ $ this ->withProgressBar (CollectionFacade::all (), function ($ collection ) use ($ importCollections , $ importCollectionTrees ) {
85+ if ($ importCollections ) {
8386 $ lastModified = $ collection ->fileLastModified ();
8487
8588 EloquentCollection::makeModelFromContract ($ collection )
8689 ->fill (['created_at ' => $ lastModified , 'updated_at ' => $ lastModified ])
8790 ->save ();
8891 }
8992
90- if ($ this -> shouldImportCollectionTrees () && $ structure = $ collection ->structure ()) {
93+ if ($ importCollectionTrees && $ structure = $ collection ->structure ()) {
9194 $ structure ->trees ()->each (function ($ tree ) {
9295 $ lastModified = $ tree ->fileLastModified ();
9396
Original file line number Diff line number Diff line change @@ -60,16 +60,19 @@ private function useDefaultRepositories(): void
6060
6161 private function importGlobals (): void
6262 {
63- $ this ->withProgressBar (GlobalSetFacade::all (), function ($ set ) {
64- if ($ this ->shouldImportGlobalSets ()) {
63+ $ importGlobals = $ this ->shouldImportGlobalSets ();
64+ $ importVariables = $ this ->shouldImportGlobalVariables ();
65+
66+ $ this ->withProgressBar (GlobalSetFacade::all (), function ($ set ) use ($ importGlobals , $ importVariables ) {
67+ if ($ importGlobals ) {
6568 $ lastModified = $ set ->fileLastModified ();
6669
6770 GlobalSet::makeModelFromContract ($ set )
6871 ->fill (['created_at ' => $ lastModified , 'updated_at ' => $ lastModified ])
6972 ->save ();
7073 }
7174
72- if ($ this -> shouldImportGlobalVariables () ) {
75+ if ($ importVariables ) {
7376 $ set ->localizations ()->each (function ($ locale ) {
7477 Variables::makeModelFromContract ($ locale )->save ();
7578 });
Original file line number Diff line number Diff line change @@ -61,16 +61,19 @@ private function useDefaultRepositories(): void
6161
6262 private function importNavs (): void
6363 {
64- $ this ->withProgressBar (NavFacade::all (), function ($ nav ) {
65- if ($ this ->shouldImportNavigations ()) {
64+ $ importNavs = $ this ->shouldImportNavigations ();
65+ $ importTrees = $ this ->shouldImportNavigationTrees ();
66+
67+ $ this ->withProgressBar (NavFacade::all (), function ($ nav ) use ($ importNavs , $ importTrees ) {
68+ if ($ importNavs ) {
6669 $ lastModified = $ nav ->fileLastModified ();
6770
6871 EloquentNav::makeModelFromContract ($ nav )
6972 ->fill (['created_at ' => $ lastModified , 'updated_at ' => $ lastModified ])
7073 ->save ();
7174 }
7275
73- if ($ this -> shouldImportNavigationTrees () ) {
76+ if ($ importTrees ) {
7477 $ nav ->trees ()->each (function ($ tree ) {
7578 $ lastModified = $ tree ->fileLastModified ();
7679
You can’t perform that action at this time.
0 commit comments