|
|
@ -8,23 +8,12 @@ use Illuminate\Foundation\Validation\ValidatesRequests; |
|
|
|
use Illuminate\Routing\Controller as BaseController; |
|
|
|
|
|
|
|
use App\Models\Bucket; |
|
|
|
use App\Facades\FileManager; |
|
|
|
|
|
|
|
class BucketController extends BaseController |
|
|
|
{ |
|
|
|
use AuthorizesRequests, DispatchesJobs, ValidatesRequests; |
|
|
|
|
|
|
|
private function formatBytes($size, $precision = 1) |
|
|
|
{ |
|
|
|
if ($size === 0) { |
|
|
|
return '0 bytes'; |
|
|
|
} |
|
|
|
|
|
|
|
$base = log($size, 1024); |
|
|
|
$suffixes = array('bytes', 'kB', 'MB', 'G', 'T'); |
|
|
|
|
|
|
|
return round(pow(1024, $base - floor($base)), $precision).' '.$suffixes[floor($base)]; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* |
|
|
@ -37,11 +26,11 @@ class BucketController extends BaseController |
|
|
|
$bucket = Bucket::find($id); |
|
|
|
|
|
|
|
// getting files
|
|
|
|
$files = FileManager::find($bucket->path); |
|
|
|
$files = FileManager::find($bucket->path); |
|
|
|
|
|
|
|
return view('bucket.single', [ |
|
|
|
'bucket' => $bucket, |
|
|
|
'files' => $results |
|
|
|
'files' => $files |
|
|
|
]); |
|
|
|
} |
|
|
|
|
|
|
|