samedi 29 septembre 2018

How to show specific user data of pivot table?

I have a many to many relationships between users and meetings table and that's why I used a meeting_user pivot table. Now I can get all the meeting information with users but I have different types of users. Now I wanted to show the meeting information with the specific user, I mean If a user is logged in my system then he can only see the meeting information of his oot other meeting information. I am arranging each meeting with 2 types of user one is host and another is visitor.

elseif ($user->userType == 'visitor') {

        $id = \Auth::user()->id;
        //$meetings = Meeting::with(['visitors','hosts'])->find($id);
        //dd($meetings);
        $meetings = Meeting::with(['visitors','hosts'])->where($user->id = $id);
    }

I am confused should how can I get the meeting data of the user who is logged in?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2NQtsKM
via IFTTT

Aucun commentaire:

Enregistrer un commentaire