Добавление пробелов в псевдонимы столбцов MySQL с помощью Laravel Eloquent ⇐ Php
Добавление пробелов в псевдонимы столбцов MySQL с помощью Laravel Eloquent
I am trying to query the database using Eloquent and export the results in a spreadsheet. My current query is fine and the process works:
$clients = Client:: select("ref as id", "title as salutation", "firstname", "surname as lastname", "tel as phone", "alttel as mobile", "email", "address1 as addressline1", "address2 as addressline2", "address3 as addressline3", "address4 as addressline4", "postcode as postalcode", "status") ->get(); I want to get field names as aliases with a space. I assumed I could do one of:
"firstname as first name" "firstname as 'first name'" "firstname as `first name`" 'firstname as "first name"' Or something similar. However none of these work. The column name is just returned as something like 'first. I have seen stuff elsewhere online to suggest this should be possible with MySQL - is it a particular Eloquent issue?
Is there some other way I need to do this?
Many thanks
Источник: https://stackoverflow.com/questions/372 ... l-eloquent
I am trying to query the database using Eloquent and export the results in a spreadsheet. My current query is fine and the process works:
$clients = Client:: select("ref as id", "title as salutation", "firstname", "surname as lastname", "tel as phone", "alttel as mobile", "email", "address1 as addressline1", "address2 as addressline2", "address3 as addressline3", "address4 as addressline4", "postcode as postalcode", "status") ->get(); I want to get field names as aliases with a space. I assumed I could do one of:
"firstname as first name" "firstname as 'first name'" "firstname as `first name`" 'firstname as "first name"' Or something similar. However none of these work. The column name is just returned as something like 'first. I have seen stuff elsewhere online to suggest this should be possible with MySQL - is it a particular Eloquent issue?
Is there some other way I need to do this?
Many thanks
Источник: https://stackoverflow.com/questions/372 ... l-eloquent
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Может ли иметь условия предложения использовать псевдонимы для столбцов?
Anonymous » » в форуме MySql - 0 Ответы
- 104 Просмотры
-
Последнее сообщение Anonymous
-