ComposerConfigCommand.php 639 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App;
  3. use Illuminate\Console\Command;
  4. class ComposerConfigCommand extends Command
  5. {
  6. protected $signature = 'admin:composer-config';
  7. public function handle()
  8. {
  9. $composer = base_path('composer.json');
  10. /* @var \Illuminate\Filesystem\Filesystem $files */
  11. $files = app('files');
  12. $contents = json_decode($files->get($composer), true);
  13. $contents['repositories'] = [
  14. [
  15. 'type' => 'path',
  16. 'url' => './dcat-admin',
  17. ],
  18. ];
  19. $files->put($composer, str_replace('\\/', '/', json_encode($contents)));
  20. }
  21. }