Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

CacheData.php 945B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Utilities\ModelCacheManager;
  4. use Illuminate\Console\Command;
  5. class CacheData extends Command
  6. {
  7. /**
  8. * The name and signature of the console command.
  9. *
  10. * @var string
  11. */
  12. protected $signature = 'cache:data';
  13. /**
  14. * The console command description.
  15. *
  16. * @var string
  17. */
  18. protected $description = 'Cache data from CSV files into the database.';
  19. /**
  20. * Execute the console command.
  21. */
  22. public function handle(): void
  23. {
  24. // ModelCacheManager::cacheData(resource_path('data/countries.csv'), 'countries');
  25. ModelCacheManager::cacheData(resource_path('data/currencies.csv'), 'currencies');
  26. // ModelCacheManager::cacheData(resource_path('data/states.csv'), 'states');
  27. // ModelCacheManager::cacheData(resource_path('data/cities.csv'), 'cities');
  28. $this->info('Data cached successfully.');
  29. }
  30. }