Fixes #8+

Enums arent using BaseEnum trait and cannot since tool low php level, need to manually implement behaviors
This commit is contained in:
Jérémy Munsch 2023-12-14 17:13:46 +01:00 • committed by Noah Lancien
parent c6eaf2f12b
commit 50832db21b
2 changed files with 21 additions and 1 deletions

View file

@ -48,4 +48,24 @@ class Historique extends Model
{
return $this->belongsTo(Media::class);
}
// * METHODS
/**
* Get the instance as an array.
*
* @return array<TKey,TValue>
*/
public function toArray(): array
{
return \array_merge(
parent::toArray(),
[
'type' => [
'value' => $this->type,
'label' => $this->type->label()
]
]
);
}
}

View file

@ -20,7 +20,7 @@
item.user.matricule
}})
</td>
<td>{{ item.type }}</td>
<td>{{ item.type.label }}</td>
<td>{{ item.description }}</td>
</tr>
</tbody>