-
app/Helpers/Functions.php
Open in GitHubfunction sizeForHumans($bytes) { if ($bytes >= 1000000000) { $bytes = number_format($bytes / 1000000000, 1) . 'GB'; } elseif ($bytes >= 1000000) { $bytes = number_format($bytes / 1000000, 1) . 'MB'; } elseif ($bytes >= 1000) { $bytes = number_format($bytes / 1000, 0) . 'KB'; } elseif ($bytes > 1) { $bytes = $bytes . ' bytes'; } elseif ($bytes == 1) { $bytes = $bytes . ' byte'; } else { $bytes = '0 bytes'; } return $bytes; }
-
resources/views/files/create.blade.php
Open in GitHub<div class="small-help"> <i class="fas fa-info-circle"></i> {{trans('messages.max_file_size')}} {{sizeForHumans(config('agorakit.max_file_size') * 1000) }} </div>
-
app/Console/Commands/DeleteFiles.php
Open in GitHubuse App\File; use Carbon\Carbon; use Illuminate\Console\Command; class DeleteFiles extends Command { public function handle() { $files = File::onlyTrashed() ->where('deleted_at', '<=', Carbon::now()->subDays(30)->toDateTimeString()) ->get(); $filesize = File::onlyTrashed() ->where('deleted_at', '<=', Carbon::now()->subDays(30)->toDateTimeString()) ->sum('filesize'); foreach ($files as $file) { $this->line($file->name.' takes '.sizeForHumans($file->filesize)); } $this->info('This would save '.sizeForHumans($filesize)); } }
-
composer.json
Open in GitHub{ "name": "agorakit/agorakit", "require": { "php": "^7.3", "barryvdh/laravel-translation-manager": "^0.5", "consoletvs/charts": "6.*", // ... }, "autoload": { "files": [ "app/Helpers/Functions.php", "app/Helpers/Filters.php" ] }, // ... other settings }