Update DownloadController.php (#1267)

* Update DownloadController.php

* StyleFix

* Another StyleFix !

* Update DownloadController.php

* Last StyleFix and Update

* Apply StyleCI fix

Co-authored-by: Nabeel Shahzad <nabeel@nabeel.sh>
This commit is contained in:
B.Fatih KOZ
2021-08-02 21:43:38 +03:00
committed by GitHub
parent 88a8ffe48a
commit 4a04d73d08
2 changed files with 18 additions and 14 deletions

View File

@@ -41,22 +41,25 @@ class DownloadController extends Controller
$klass = new $class(); $klass = new $class();
$obj = $klass->find($id); $obj = $klass->find($id);
$category = explode('\\', $class); // Check if the object is there first
$category = end($category); if (isset($obj)) {
$category = explode('\\', $class);
$category = end($category);
if ($category == 'Aircraft' && $airlines > 1) { if ($category == 'Aircraft' && $airlines > 1) {
$group_name = $category.' > '.$obj->subfleet->airline->name.' '.$obj->icao.' '.$obj->registration; $group_name = $category.' > '.$obj->subfleet->airline->name.' '.$obj->icao.' '.$obj->registration;
} elseif ($category == 'Aircraft') { } elseif ($category == 'Aircraft') {
$group_name = $category.' > '.$obj->icao.' '.$obj->registration; $group_name = $category.' > '.$obj->icao.' '.$obj->registration;
} elseif ($category == 'Airport') { } elseif ($category == 'Airport') {
$group_name = $category.' > '.$obj->icao.' : '.$obj->name.' ('.$obj->country.')'; $group_name = $category.' > '.$obj->icao.' : '.$obj->name.' ('.$obj->country.')';
} elseif ($category == 'Subfleet' && $airlines > 1) { } elseif ($category == 'Subfleet' && $airlines > 1) {
$group_name = $category.' > '.$obj->airline->name.' '.$obj->name; $group_name = $category.' > '.$obj->airline->name.' '.$obj->name;
} else { } else {
$group_name = $category.' > '.$obj->name; $group_name = $category.' > '.$obj->name;
}
$regrouped_files[$group_name] = $files;
} }
$regrouped_files[$group_name] = $files;
} }
ksort($regrouped_files, SORT_STRING); ksort($regrouped_files, SORT_STRING);

View File

@@ -0,0 +1 @@
'stored' => '保存',