V
V
vitkuz5732021-03-01 15:17:15
Laravel
vitkuz573, 2021-03-01 15:17:15

How to get data from parent table by key from child table?

There are 2 tables:

servers:

id
ip_address
domain_name
web_server
plugins


status:
id
server_id
status_location


The status table may not contain all servers from servers.

The server_id field of the status table is related to the id field of the servers table.

Question: how can I get the value of the domain_name field from the parent servers table by accessing it by server_id from the status table using Eloquent?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
netrox, 2021-03-01
@vitkuz573

https://laravel.com/docs/8.x/eloquent-relationship...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question