How can I alias a column name in a model? I would like to show idUser instead of id in API responses. So far I've tried the following.
protected $maps = [
'id' => 'idUser',
];
protected $visible = [
'idUser'
];
protected $appends = [
'idUser'
];
This gives me an error:
'Call to undefined method App\User::getIdUserAttribute()'
Also, I would like to alias created_at and updated_at to createdAt and updatedAt.