Last active
July 24, 2022 20:06
-
-
Save ceilidhboy/4e806922f268c24150539506a8c029ca to your computer and use it in GitHub Desktop.
Laravel Artisan command to clear the laravel.log file. Usage: php artisan log:clear
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Console\Commands\Log; | |
use Illuminate\Console\Command; | |
class ClearLogFile extends Command | |
{ | |
protected $signature = 'log:clear'; | |
protected $description = 'Clear the laravel.log file'; | |
public function handle(): int | |
{ | |
exec('echo "" > '.storage_path('logs/laravel.log')); | |
$this->info('laravel.log has been cleared'); | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment