Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

Could you also post schemas for detaliicommat and comenzimaterial tables.

0

Detaliicommat Detaliicommat

Comenzimaterial Comenzimaterial

     @foreach($orders as $order)
	
	<p>{{ $order->Poz }}
	{{ $order->Nrcommat }}
	{{ $order->Data }}</p>
	{{ $order->details }}
	
 @endforeach

$order-details return an array with all the data..but i can't access $order->details->Nrcommat etc.

Last updated 2 years ago.
0

I solved it.. If someone else has this problem.. I've dd($order->details) and notices that my foreign key was set to orders_id..and my foreign key should be Nrcommat.

   public function orders()
    {
	   return $this->belongsTo('App\Orders', 'Nrcommat', 'Nrcommat');
    }

same for details method. Thank you for help.

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

soluicius soluicius Joined 24 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.