my problem is pretty straightforward but i am unable to find a solution.
the following code
{{$proposition->User}}
it returns the following as it should do, nothing weird here.
{
"id":"2",
"telefoon":"",
"mobiel":"0622222222",
"adres_huisnmr":"4e Binnenvestgracht",
"email":"rubend@gmail.com",
"postcode":"",
"stad":"leiden",
"achternaam":"Morgenland",
"bio":"",
"created_at":"2014-12-15 14:35:38",
"updated_at":"2014-12-15 14:35:38"
}
the following code however
{{$proposition->User->achternaam}}
generates the following error:
Trying to get property of non-object (View: /home/collective/projects/laravel/app/views/Account/received_propositions.blade.php)
so as far as i can tell, the ORM is correct. the variable that i am trying to display IS there as shown in the first example. but why does this not work?
i hope someone can help me because i am stuck on this (what should be a relatively easy problem) for hours.
EDIT
the following generates an error
@foreach($jobs as $job)
<li>De Job: {{$job->titel}}, {{$job->prijs}} euro, {{$job->beschrijving}} **todo**more info</li>
@foreach($job->Propositions as $proposition)
<ul>
<li>
offerte: {{$proposition->titel}} prijs: {{$proposition->prijs}}
------->>this line! geplaatsts door : {{$proposition->User->email}}
</li>
</ul>
@endforeach
@endforeach
if i change it to the following by adding a if statement that checks if the User!=null it WILL work, but it will only for the first one in the loop. all the other ones it will be left blank. the ORM is solid.
who can help me? really breaking my head over this
@foreach($jobs as $job)
<li>De Job: {{$job->titel}}, {{$job->prijs}} euro, {{$job->beschrijving}} **todo**more info</li>
@foreach($job->Propositions as $proposition)
<ul>
<li>
offerte: {{$proposition->titel}} prijs: {{$proposition->prijs}}
geplaatsts door : @if($proposition->User)
{{$proposition->User->email}}
@endif
</li>
</ul>
@endforeach
@endforeach
<ul>
</ul>