From 999157825f997d2c65a2af7fb9e02b119cafb0f7 Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Tue, 16 Oct 2018 20:28:59 -0300 Subject: [PATCH] Fixed bug causing error 500 on production Some PHP version or configuration were causing this error. On app.blade.php of local branch, I could use "$usedItems ? :" even if $usedItems were null, but I had to check an "isset" to the production. On HomecController, I had to change the "object" parameter of getUsername to "\Illuminate\Database\Eloquent\Collection" to make it work. I took the chance to just show the number of itens in use if it were greater than 0. --- app/Http/Controllers/HomeController.php | 2 +- resources/views/layouts/app.blade.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index e452cf5..6438773 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -55,7 +55,7 @@ class HomeController extends Controller * * @return void */ - public function getUsername(object $itemUsers, ?int $id) + protected function getUsername(\Illuminate\Database\Eloquent\Collection $itemUsers, ?int $id) { if ($id && !isset($this->activeUsers[$id])) { $this->activeUsers[$id] = $this->findName($itemUsers, $id); diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 8cf8344..4b94d7a 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -8,7 +8,7 @@ - {{ config('app.name', 'Laravel') }} {{ isset($usedItems) ? "(${usedItems})" : '' }} + {{ config('app.name', 'Laravel') }} {{ isset($usedItems) && $usedItems > 0 ? "(${usedItems})" : '' }}