File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,4 +148,13 @@ public function enable($slug);
148148 * @return bool
149149 */
150150 public function disable ($ slug );
151+
152+ /**
153+ * Get all modules by specified location
154+ *
155+ * @param string $location
156+ *
157+ * @return \Illuminate\Support\Collection
158+ */
159+ public function byLocation ($ location );
151160}
Original file line number Diff line number Diff line change @@ -213,6 +213,20 @@ public function disable($slug)
213213 {
214214 return $ this ->set ($ slug .'::enabled ' , false );
215215 }
216+
217+ /**
218+ * Get all modules by specified location
219+ *
220+ * @param string $location
221+ *
222+ * @return \Illuminate\Support\Collection
223+ */
224+ public function byLocation ($ location )
225+ {
226+ $ manifest = $ this ->getCachePath ($ location );
227+
228+ return collect (json_decode ($ this ->files ->get ($ manifest ), true ));
229+ }
216230
217231 /*
218232 |--------------------------------------------------------------------------
@@ -299,13 +313,13 @@ private function createCache()
299313 *
300314 * @return string
301315 */
302- private function getCachePath ()
316+ private function getCachePath ($ location = null )
303317 {
304318 if (!$ this ->files ->isDirectory (storage_path ("app/modules " ))) {
305319 $ this ->files ->makeDirectory (storage_path ("app/modules " ));
306320 }
307321
308- $ location = Str::slug ($ this ->location );
322+ $ location = Str::slug ($ location ?? $ this ->location );
309323
310324 return storage_path ("app/modules/ $ location.json " );
311325 }
You can’t perform that action at this time.
0 commit comments