Hello guys, happy new year.
Please can someone help me convert this eloquent query to a raw SQL query where I can use in phpMyAdmin to get the same result.
The database structure is
An employee hasOne profile, the profile hasOne introductionTranslation which translates the introduction text to different languages being spanish and french and just stores the id of the translation on the profile table. Same goes for work experience and education.
the query is
$employee = Employee::with(
[
'profile',
'profile.introduction_translations',
'profile.work_experience_translations',
'profile.education_translations'
]
)->first();
this is the sample response
array:10 [▼
"name" => "Chinonso Eke"
"birth_date" => "1996-05-13"
"ssn" => "2231312321321321"
"current_employee" => 1
"email" => "[email protected]"
"phone" => "07063944465"
"address" => "Lagos, Nigeria"
"created_at" => "2020-01-07 18:38:10"
"updated_at" => "2020-01-07 18:38:10"
"profile" => array:8 [▼
"introduction" => """
A paragraph is a group of words put together to form a group that is usually longer than a sentence. Paragraphs are often made up of several sentences. There ar ▶
In most organized forms of writing, such as essays, paragraphs contain a topic sentence . This topic sentence of the paragraph tells the reader what ▶
Paragraphs may signal when the writer changes topics. Each paragraph may have a number of sentences, depending on the topic.
"""
"work_experience" => """
Work experience called internship in North American English, is any experience that a person gains while working in a specific field or occupation, but the expr ▶
Though the placements are usually unpaid, travel and food expenses are sometimes covered, and at the end of the appointment, a character reference i ▶
"""
"education" => "Education is the process of facilitating learning, or the acquisition of knowledge, skills, values, beliefs, and habits. Educational methods include teaching, t ▶"
"created_at" => "2020-01-07 18:38:10"
"updated_at" => "2020-01-07 18:38:10"
"introduction_translations" => array:4 [▼
"text_ES" => """
Un párrafo es un grupo de palabras juntas para formar un grupo que generalmente es más largo que una oración. Los párrafos a menudo se componen de varias oracio ▶
En la mayoría de las formas organizadas de escritura, como los ensayos, los párrafos contienen una oración temática. Esta oración temática del párra ▶
Los párrafos pueden indicar cuándo el escritor cambia de tema. Cada párrafo puede tener varias oraciones, según el tema.
"""
"text_FR" => """
Un paragraphe est un groupe de mots réunis pour former un groupe qui est généralement plus long qu'une phrase. Les paragraphes sont souvent composés de plusieur ▶
Dans la plupart des formes d'écriture organisées, comme les essais, les paragraphes contiennent une phrase de sujet. Cette phrase de sujet du paragr ▶
Les paragraphes peuvent signaler quand l'auteur change de sujet. Chaque paragraphe peut avoir un certain nombre de phrases, selon le sujet.
"""
"created_at" => "2020-01-07 18:38:10"
"updated_at" => "2020-01-07 18:38:10"
]
"work_experience_translations" => array:4 [▼
"text_ES" => """
La experiencia laboral llamada pasantía en inglés norteamericano es cualquier experiencia que una persona adquiere mientras trabaja en un campo u ocupación espe ▶
Aunque las ubicaciones generalmente no son remuneradas, los gastos de viaje y comida a veces están cubiertos, y al final de la cita, generalmente se ▶
"""
"text_FR" => """
Une expérience de travail appelée stage en anglais nord-américain, est toute expérience qu'une personne acquiert en travaillant dans un domaine ou une professio ▶
Bien que les placements soient généralement non rémunérés, les frais de voyage et de nourriture sont parfois couverts et, à la fin du rendez-vous, u ▶
"""
"created_at" => "2020-01-07 18:38:10"
"updated_at" => "2020-01-07 18:38:10"
]
"education_translations" => array:4 [▼
"text_ES" => "La educación es el proceso de facilitar el aprendizaje o la adquisición de conocimientos, habilidades, valores, creencias y hábitos. Los métodos educativos incl ▶"
"text_FR" => "L'éducation est le processus qui facilite l'apprentissage ou l'acquisition de connaissances, de compétences, de valeurs, de croyances et d'habitudes. Les méthod ▶"
"created_at" => "2020-01-07 18:38:10"
"updated_at" => "2020-01-07 18:38:10"
]
]
]