@@ -24,6 +24,9 @@ public function boot()
24
24
$ this ->file = app ('files ' );
25
25
26
26
$ this ->packagePublish ();
27
+ $ this ->observers ();
28
+ $ this ->macros ();
29
+ $ this ->viewComp ();
27
30
$ this ->app ['simplemenu ' ];
28
31
29
32
// append extra data
@@ -65,56 +68,6 @@ protected function packagePublish()
65
68
$ this ->publishes ([
66
69
__DIR__ . '/resources/views ' => resource_path ('views/vendor/SimpleMenu ' ),
67
70
], 'views ' );
68
-
69
- $ this ->observers ();
70
- $ this ->macros ();
71
- $ this ->viewComp ();
72
- }
73
-
74
- /**
75
- * [autoReg description].
76
- *
77
- * @return [type] [description]
78
- */
79
- protected function autoReg ()
80
- {
81
- // routes
82
- $ route_file = base_path ('routes/web.php ' );
83
- $ search = 'SimpleMenu ' ;
84
-
85
- if ($ this ->checkExist ($ route_file , $ search )) {
86
- $ data = "\n// SimpleMenu \nSimpleMenu::menuRoutes(); " ;
87
-
88
- $ this ->file ->append ($ route_file , $ data );
89
- }
90
-
91
- // mix
92
- $ mix_file = base_path ('webpack.mix.js ' );
93
- $ search = 'SimpleMenu ' ;
94
-
95
- if ($ this ->checkExist ($ mix_file , $ search )) {
96
- $ data = "\n// SimpleMenu \nmix.sass('resources/assets/vendor/SimpleMenu/sass/style.scss', 'public/assets/vendor/SimpleMenu/style.css').version(); " ;
97
-
98
- $ this ->file ->append ($ mix_file , $ data );
99
- }
100
-
101
- // run check once
102
- app ('cache ' )->store ('file ' )->rememberForever ('ct-sm ' , function () {
103
- return 'added ' ;
104
- });
105
- }
106
-
107
- /**
108
- * [checkExist description].
109
- *
110
- * @param [type] $file [description]
111
- * @param [type] $search [description]
112
- *
113
- * @return [type] [description]
114
- */
115
- protected function checkExist ($ file , $ search )
116
- {
117
- return $ this ->file ->exists ($ file ) && !str_contains ($ this ->file ->get ($ file ), $ search );
118
71
}
119
72
120
73
/**
@@ -168,6 +121,52 @@ protected function viewComp()
168
121
});
169
122
}
170
123
124
+ /**
125
+ * [autoReg description].
126
+ *
127
+ * @return [type] [description]
128
+ */
129
+ protected function autoReg ()
130
+ {
131
+ // routes
132
+ $ route_file = base_path ('routes/web.php ' );
133
+ $ search = 'SimpleMenu ' ;
134
+
135
+ if ($ this ->checkExist ($ route_file , $ search )) {
136
+ $ data = "\n// SimpleMenu \nSimpleMenu::menuRoutes(); " ;
137
+
138
+ $ this ->file ->append ($ route_file , $ data );
139
+ }
140
+
141
+ // mix
142
+ $ mix_file = base_path ('webpack.mix.js ' );
143
+ $ search = 'SimpleMenu ' ;
144
+
145
+ if ($ this ->checkExist ($ mix_file , $ search )) {
146
+ $ data = "\n// SimpleMenu \nmix.sass('resources/assets/vendor/SimpleMenu/sass/style.scss', 'public/assets/vendor/SimpleMenu/style.css').version(); " ;
147
+
148
+ $ this ->file ->append ($ mix_file , $ data );
149
+ }
150
+
151
+ // run check once
152
+ app ('cache ' )->store ('file ' )->rememberForever ('ct-sm ' , function () {
153
+ return 'added ' ;
154
+ });
155
+ }
156
+
157
+ /**
158
+ * [checkExist description].
159
+ *
160
+ * @param [type] $file [description]
161
+ * @param [type] $search [description]
162
+ *
163
+ * @return [type] [description]
164
+ */
165
+ protected function checkExist ($ file , $ search )
166
+ {
167
+ return $ this ->file ->exists ($ file ) && !str_contains ($ this ->file ->get ($ file ), $ search );
168
+ }
169
+
171
170
/**
172
171
* Register any package services.
173
172
*/
0 commit comments