A
A
Andriy Sub2019-10-01 14:14:16
Laravel
Andriy Sub, 2019-10-01 14:14:16

How to display data through a connection?

SQL
5d93340e3a868992948709.jpeg
Damp (связь result_test)
5d933453a96f2612226970.jpeg
Foreach
5d93346620aab257909804.jpeg
I try
$user->result_test->estimate
but I get error Property [estimate] does not exist on this collection instance. ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin B., 2019-10-01
@Kostik_1993

So, what is your connection? What did she return? Collection. So you are accessing a collection, not a single element

// так
$user->result_test->first()->estimate
// или так
foreach($user->result_test as $res)
$res->estimate
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question