-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathHome.php
More file actions
30 lines (26 loc) · 859 Bytes
/
Copy pathHome.php
File metadata and controls
30 lines (26 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespace App\Controllers;
use App\Models\DungeonModel;
use App\Models\HeroModel;
class Home extends BaseController
{
public function index(): string
{
// When you don't need to use a model in multiple places
// you can simply get a new instance here. It will use
// the default database connection if none is passed in
// during instantiation.
$heroes = new HeroModel();
$dungeons = new DungeonModel();
return view('home', [
// Note that we can intermingle builder and model methods
// when making calls against the model.
'heroes' => $heroes
->orderBy('name', 'asc')
->findAll(),
'dungeons' => $dungeons
->orderBy('difficulty', 'desc')
->findAll(),
]);
}
}