My User.php Model function is this
public function send_connection_requests()
{
return $this->hasMany('App\Models\ConnectionRequest','from_user');
}
public function received_connection_requests()
{
return $this->hasMany('App\Models\ConnectionRequest','to_user');
}
and my coonectionRequest realtionship is this->
public function send_connection_requests()
{
return $this->belongsto('App\User','id');
}`
public function received_connection_requests()
{
return $this->belongsto('App\User','id');
}`
`
When I am calling function
@foreach (Auth::user()->send_connection_requests as $request)
{{request->to_user}}
@endforech
I'm only getting connection request table data which contains from_user and to_user id and i need to show their name which user send request and which user recived request ?