make() публичный статический Метод

Make new instance.
public static make ( string $path, Illuminate\Filesystem\Filesystem $filesystem = null ) : static
$path string
$filesystem Illuminate\Filesystem\Filesystem
Результат static
Пример #1
0
 /**
  * Install modules from modules.json file.
  */
 protected function installFromFile()
 {
     if (!file_exists($path = base_path('modules.json'))) {
         $this->error("File 'modules.json' does not exist in your project root.");
         return;
     }
     $modules = Json::make($path);
     $dependencies = $modules->get('require', []);
     foreach ($dependencies as $module) {
         $module = collect($module);
         $this->install($module->get('name'), $module->get('version'), $module->get('type'));
     }
 }
Пример #2
0
 /** @test */
 public function it_makes_json_class()
 {
     $path = __DIR__ . '/stubs/module.json';
     $json = Json::make($path, $this->app['files']);
     $this->assertInstanceOf(Json::class, $json);
 }
Пример #3
0
 /**
  * Get & scan all modules.
  *
  * @return array
  */
 public function scan()
 {
     $paths = $this->getScanPaths();
     $modules = [];
     foreach ($paths as $key => $path) {
         $manifests = $this->app['files']->glob("{$path}/module.json");
         is_array($manifests) || ($manifests = []);
         foreach ($manifests as $manifest) {
             $name = Json::make($manifest)->get('name');
             $modules[$name] = new Module($this->app, $name, dirname($manifest));
         }
     }
     return $modules;
 }