if i use as
to name a column NULL is returned. I want to name the column like (id_company as idC)
.
This is the code in question:
$entity = Entity::with(['typeEntity' => function ($q) {
$q->select(['id_type_entity as ite', 'name_type_entity'])->get();
}, 'company' => function ($q) {
$q->select(['id_company', 'name_company'])->get();
}])->get();
Without this, it works as expected.