Last active
April 28, 2019 05:28
-
-
Save coreymcmahon/bedfbd5fa481df8a55ee4c03dffb9183 to your computer and use it in GitHub Desktop.
Demonstration of a Laravel console command.
This file contains hidden or 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; | |
use Illuminate\Console\Command; | |
class CleanTempCommand extends Command | |
{ | |
protected $signature = "app:clean-temp"; | |
protected $description = 'Clears out the temporary files folder.'; | |
public function handle() | |
{ | |
$unlinked = 0; | |
foreach (glob("storage/tmp/*.*") as $file) { | |
unlink($file); | |
$unlinked++; | |
} | |
$this->info("\nUnlinked {$unlinked} files." | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment