2 changed files
app/Http/Controllers | ||
HomeController.php | ||
resources/views | ||
downloads.blade.php | ||
HomeController.php
/app/Http/Controllers/HomeController.php-7+7/app/Http/Controllers/HomeController.php
Add comment 14 function downloadsView(Request $request): Factory|View|Application
Add comment 15 {
Add comment 16 $files = ['latest' => []];
Add comment 17 Minus $disk = Storage::disk('public');
Add comment 18 Minus $latestFiles = $disk->allFiles('latest');
Add comment 17 Plus $folder = Storage::disk('public');
Add comment 18 Plus $latestFiles = $folder->allFiles('latest');
Add comment 19
Add comment 20 foreach ($latestFiles as $file)
Add comment 21 {
Add comment 22 Minus if (pathinfo($file, PATHINFO_EXTENSION) != 'exe')
Add comment 23 Minus continue;
Add comment 22 Plus // if (pathinfo($file, PATHINFO_EXTENSION) != 'exe')
Add comment 23 Plus // continue;
Add comment 24
Add comment 25 Minus $fileSize = $disk->size($file) / 1024;
Add comment 25 Plus $fileSize = $folder->size($file) / 1024;
Add comment 26 $base = log($fileSize) / log(1024);
Add comment 27 $presentationSize = round(pow(1024, $base - floor($base)), 2) . ' MB';
Add comment 28
Add comment 29 $info = [
Add comment 30 Minus 'url' => $disk->url($file),
Add comment 31 Minus 'name' => pathinfo($file, PATHINFO_FILENAME),
Add comment 30 Plus 'url' => $folder->url($file),
Add comment 31 Plus 'name' => pathinfo($file, PATHINFO_BASENAME),
Add comment 32 'size' => $presentationSize
Add comment 33 ];
Add comment 34 $files['latest'][] = $info;
Add comment 39 <tr>
Add comment 40 <td>{{ $file['name'] }}</td>
Add comment 41 <td>{{ $file['size'] }}</td>
Add comment 42 Minus <td>{{ $file['url'] }}</td>
Add comment 42 Plus <td><a href="{{ $file['url'] }}">Descargar</a></td>
Add comment 43 </tr>
Add comment 44
Add comment 45 @endforeach