PHP code example of harman / filament-disk-cleanup
1. Go to this page and download the library: Download harman/filament-disk-cleanup 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/ */
harman / filament-disk-cleanup example snippets
use Harman\FilamentDiskCleanup\Cleanup;
class User
{
//--
protected static function booted()
{
static::deleted(function (User $user) {
Cleanup::delete($user, 'avatar');
});
static::saved(function (User $user) {
Cleanup::update($user, 'avatar');
});
}
//--
}
use Harman\FilamentDiskCleanup\Cleanup;
class Document
{
//--
protected static function booted()
{
static::deleted(function (Document $document) {
Cleanup::delete($document, 'files');
});
static::saved(function (Document $document) {
Cleanup::update($document, 'files');
});
}
//--
}