tomasosho
1 month ago
406
16
General

Help correct my query

Posted 1 month ago by tomasosho

I want my from to be the current user selected since it's opens on my show page and the to to be the authenticated user.

My Show

$chatlist = Message::whereIn('to', [$id])->with('fromContact')->get();

Model

public function fromContact()
    {
        return $this->hasOne(User::class, 'id', 'from');
    }

Please sign in or create an account to participate in this conversation.