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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 14 deletions

View File

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

View File

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