PHP code example of masterro / laravel-file-cleaner

1. Go to this page and download the library: Download masterro/laravel-file-cleaner library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

masterro / laravel-file-cleaner example snippets


FileCleaner::voteDeleteUsing(function($path, $entity) {
    if (isset($entity) && !$entity->user->isActive()) {
        return true;
    }

    return false;
});

protected function schedule(Schedule $schedule)
{
    $schedule->command('file-cleaner:clean')->everyMinute();
}

php artisan vendor:publish --provider="MasterRO\LaravelFileCleaner\FileCleanerServiceProvider"

php artisan file-cleaner:clean

php artisan file-cleaner:clean -f

php artisan file-cleaner:clean -f --excluded-paths=public/uploads/images/default,public/uploads/test

php artisan file-cleaner:clean -f --excluded-files=public/uploads/images/default.png,public/uploads/test/01.png