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.
This commit is contained in:
Bruno F. Fontes 2018-10-16 20:28:59 -03:00
parent 840f0a777a
commit 999157825f
2 changed files with 2 additions and 2 deletions

View File

@ -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);

View File

@ -8,7 +8,7 @@
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }} {{ isset($usedItems) ? "(${usedItems})" : '' }}</title>
<title>{{ config('app.name', 'Laravel') }} {{ isset($usedItems) && $usedItems > 0 ? "(${usedItems})" : '' }}</title>
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script>