Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 1 year ago.
0

You question is slightly confusing as I don't know what the other table is outside User. You first need to figure out the type of relationship between user table and the other.

Check documentation for an example - https://laravel.com/docs/5.2/eloquent-relationships#defining-r...

0

Thanks.

I tryed

public function GetUser(){ return $this->belongsTo(Usuario::class, 'id_usuarios', 'fk_usuarios'); }

and into view have this code:

@if (count($user->GetUser) > 0) @foreach($user->GetUser AS $us) de [ {{ $us->nombre_usuarios }} ] @endforeach @endif

What I do wrong?

The error: Trying to get property of non-object (View: F:\Fnt\Web\Economato\Fuentes\resources\views\welcome.blade.php)

Last updated 7 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

paucurro paucurro Joined 30 Aug 2016

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.