PHP code example of jcergolj / filesystem-disk-cleanup-for-laravel

1. Go to this page and download the library: Download jcergolj/filesystem-disk-cleanup-for-laravel 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/ */

    

jcergolj / filesystem-disk-cleanup-for-laravel example snippets


// filesystem-disk-cleanup.php


return [
    'disks' => [
        // jcergolj-test must match the name in filesystem.php disk config file
        'jcergolj-test' => [
            'delete_files_older_than_minutes' => 60 * 24 * 7,
        ],
    ],
];

// config/filesystem.php


return [
    'default' => env('FILESYSTEM_DISK', 'local'),

    'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
            'throw' => false,
        ],

        'jcergolj-test' [
            'driver' => 'local',
            'root' => storage_path('app/jceroglj-folder'),
            'throw' => false,
        ],

        // ...
    ],
];

    // app/Console/Kernel.php
    $schedule->command('filesystem-disk:cleanup')->daily()->at('01:00');
bash
    php artisan vendor:publish --provider="Jcergolj\FilesystemDiskCleanup\FilesystemDiskCleanupServiceProvider" --tag="config"