Skip to content

Commit 4546203

Browse files
committed
refactor: replace $heroes with $dungeons
1 parent 473d9e2 commit 4546203

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

app/Controllers/DungeonController.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,37 @@
33
namespace App\Controllers;
44

55
use App\Models\DungeonModel;
6-
use App\Models\HeroModel;
76
use CodeIgniter\HTTP\ResponseInterface;
87

98
class DungeonController extends BaseController
109
{
1110
/**
12-
* HeroModel instance.
11+
* DungeonModel instance.
1312
*/
14-
protected $heroes;
13+
protected DungeonModel $dungeons;
1514

1615
public function __construct()
1716
{
18-
// Assign the model to $this->heroes
17+
// Assign the model to $this->dungeons
1918
// so that it's available throughout this class
2019
// Use the `model()` helper method to return
2120
// a single instance of the model no matter
2221
// how many times we call it
23-
$this->heroes = model(DungeonModel::class);
22+
$this->dungeons = model(DungeonModel::class);
2423
}
2524

2625
/**
27-
* View a single hero's details.
26+
* View a single dungeon's details.
2827
*
29-
* The $id parameter is the hero's ID, and is
28+
* The $id parameter is the dungeon's ID, and is
3029
* passed in from the route definition as $1,
3130
* since it is the first placeholder in the route.
3231
*
3332
* @return ResponseInterface|string
3433
*/
3534
public function show(int $id)
3635
{
37-
$dungeon = $this->heroes->find($id);
36+
$dungeon = $this->dungeons->find($id);
3837

3938
if ($dungeon === null) {
4039
return redirect()->back()->with('error', 'Dungeon not found');

0 commit comments

Comments
 (0)