Species
- Here you can find all collectable species. There are a total of {{ count($elephpants) }} species collected.
+ Here you can find all existent species. There are a total of {{ count($elephpants) }} species collected.
Go to "My Herd" page
From 3f5b943a53aa27234c87063483df73e7e6658b68 Mon Sep 17 00:00:00 2001
From: JonPurvis
Date: Sat, 29 Jul 2023 17:40:07 +0100
Subject: [PATCH 04/10] remove unneeded logic
---
app/Console/Commands/ReadElephpants.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/Console/Commands/ReadElephpants.php b/app/Console/Commands/ReadElephpants.php
index f2c7efe..4d04bce 100644
--- a/app/Console/Commands/ReadElephpants.php
+++ b/app/Console/Commands/ReadElephpants.php
@@ -27,7 +27,7 @@ public function handle(): void
'sponsor' => $elephpant->sponsor,
'year' => (int)$elephpant->year,
'image' => $this->processImage($elephpant),
- 'prototype' => $elephpant->prototype ?: 0
+ 'prototype' => $elephpant->prototype
]
);
}
From 43f77e72060e6524c8a0a7871969e45cc06541fe Mon Sep 17 00:00:00 2001
From: JonPurvis
Date: Sat, 29 Jul 2023 18:14:17 +0100
Subject: [PATCH 05/10] add prototype to factory
---
database/factories/ElephpantFactory.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/database/factories/ElephpantFactory.php b/database/factories/ElephpantFactory.php
index 9e816a1..c085646 100644
--- a/database/factories/ElephpantFactory.php
+++ b/database/factories/ElephpantFactory.php
@@ -12,5 +12,6 @@
'year' => (int)$faker->dateTimeBetween('-12 years', 'now')->format('Y'),
'sponsor' => $faker->company,
'image' => $faker->imageUrl(),
+ 'prototype' => $faker->boolean(1)
];
});
From b9d83ce2c1db170b74b0720cd11dd621e35a5b28 Mon Sep 17 00:00:00 2001
From: JonPurvis
Date: Fri, 4 Aug 2023 01:48:39 +0100
Subject: [PATCH 06/10] update latest elephpants
---
resources/data/elephpants.json | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/resources/data/elephpants.json b/resources/data/elephpants.json
index 3763b33..58aea03 100644
--- a/resources/data/elephpants.json
+++ b/resources/data/elephpants.json
@@ -654,7 +654,8 @@
"description": "ElePHPant for Alumni",
"sponsor": "CMGT",
"year": 2022,
- "image": "73-cmgt.jpeg"
+ "image": "73-cmgt.jpeg",
+ "prototype": false
},
{
"id": 74,
@@ -662,7 +663,8 @@
"description": "Laracon US 2023",
"sponsor": "Laravel Community",
"year": 2023,
- "image": "74-aubrey.jpg"
+ "image": "74-aubrey.jpg",
+ "prototype": false
}
]
}
From 2671f5e1699aeb4fa02b898cef6e639680c43aa7 Mon Sep 17 00:00:00 2001
From: JonPurvis
Date: Sat, 5 Aug 2023 02:17:35 +0100
Subject: [PATCH 07/10] show owners count
---
app/Http/Controllers/ElephpantController.php | 7 ++++++-
app/Http/Controllers/HomeController.php | 9 +++++++--
resources/views/elephpant/_single_box.blade.php | 6 ++++--
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/app/Http/Controllers/ElephpantController.php b/app/Http/Controllers/ElephpantController.php
index 4118f3d..e33857a 100644
--- a/app/Http/Controllers/ElephpantController.php
+++ b/app/Http/Controllers/ElephpantController.php
@@ -9,7 +9,12 @@ class ElephpantController extends Controller
{
public function index()
{
- $elephpants = Elephpant::query()->withoutGlobalScope('nonPrototype')->orderBy('year', 'desc')->orderBy('id', 'desc')->get();
+ $elephpants = Elephpant::query()
+ ->withCount('users')
+ ->withoutGlobalScope('nonPrototype')
+ ->orderBy('year', 'desc')
+ ->orderBy('id', 'desc')
+ ->get();
return view('elephpant.index', compact('elephpants'));
}
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index 07ec8d0..69fabab 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -8,8 +8,13 @@ class HomeController extends Controller
{
public function index()
{
- $elephpants = Elephpant::query()->withoutGlobalScope('nonPrototype')->orderBy('year', 'desc')->orderBy('id', 'desc')->get();
-
+ $elephpants = Elephpant::query()
+ ->withCount('users')
+ ->withoutGlobalScope('nonPrototype')
+ ->orderBy('year', 'desc')
+ ->orderBy('id', 'desc')
+ ->get();
+
return view('home', compact('elephpants'));
}
}
diff --git a/resources/views/elephpant/_single_box.blade.php b/resources/views/elephpant/_single_box.blade.php
index f2587ca..c28bbd7 100644
--- a/resources/views/elephpant/_single_box.blade.php
+++ b/resources/views/elephpant/_single_box.blade.php
@@ -9,9 +9,11 @@
{{ $elephpant->description }}
{{ $elephpant->sponsor }}
- {{ $elephpant->year }}
+ {{ $elephpant->year }}
@if ($elephpant->prototype)
- • Prototype Only
+ Prototype Only
+ @else
+ {{ $elephpant->users_count }} {{ Str::plural('owner', $elephpant->users_count) }}
@endif
From 9cbcebb9df055d7953d28770bdb122b417fb003e Mon Sep 17 00:00:00 2001
From: JonPurvis