forked from codeigniter4projects/playground
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonster.php
More file actions
45 lines (39 loc) · 898 Bytes
/
Copy pathMonster.php
File metadata and controls
45 lines (39 loc) · 898 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace App\Entities;
use CodeIgniter\Entity\Entity;
/**
* Class Monster
*
* This class represents a single row in the
* `monsters` database.
*
* @property int $dungeon_id
*/
class Monster extends Entity
{
/**
* @var array<string, string>
*/
protected $casts = [
'health' => 'integer',
'dungeon_id' => 'integer',
];
/**
* Entities are the perfect place for
* convenience methods made to clean up data.
*/
public function image(): string
{
$fileName = strtolower($this->name);
return base_url("images/{$fileName}.png");
}
/**
* Help! Monsters each have their own set of abilities (see Database/Seeds) but
* our entity has no way of knowing what those are. Can you write it?
*
* @return array
*/
// public function getAbilities(): array
// {
// }
}