You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. class ClearLog extends Command
  5. {
  6. /**
  7. * The name and signature of the console command.
  8. *
  9. * @var string
  10. */
  11. protected $signature = 'clear:log';
  12. /**
  13. * The console command description.
  14. *
  15. * @var string
  16. */
  17. protected $description = 'Clear the log file.';
  18. /**
  19. * Execute the console command.
  20. */
  21. public function handle(): void
  22. {
  23. $logFile = storage_path('logs/laravel.log');
  24. if (file_exists($logFile)) {
  25. unlink($logFile);
  26. }
  27. $this->info('Log file cleared successfully.');
  28. }
  29. }