i have 2 table that they have one to many relation and i want to get all client information and name user in blade
it is user model
public function FirstClients(){
return $this->hasMany("App\Models\FirstClient");
}
it is client model
public function User(){
return $this->belongsTo('App\Models\User');
}
it is controller
$allclients= DB::table('first_clients')->get();
return view('admin.client.allclients' , compact('allclients'));
and this is blade
@foreach ($allclients as $client)
<tr>
<td>{{ $client->user->name}}</td>
<tr/>
@endforeach
and i have this error
Undefined property: stdClass::$user