Search code examples
phplaraveljitsijitsi-meet

Where clause get nothing & (local.ERROR: Undefined variable: meeting) even if defined


Instructor or Customer want to join a meeting through jitsi-meet which one of admin creates before. But when someone tried to join, this ->

"local.ERROR: Undefined variable: meeting"

error showing.

I var_dump $jitsimeetings from where clause but seeing nothing in it. some one help me please.

#Model

<?php
    
    namespace App;
    
    use Illuminate\Database\Eloquent\Factories\HasFactory;
    use Illuminate\Database\Eloquent\Model;
    
    class JitsiMeeting extends Model
    {
    
        protected $table = 'jitsimeetings';
        
        protected $fillable = ['meeting_id', 'owner_id', 'user_id','meeting_title', 'start_time', 'end_time','duration', 'jitsi_url',  'course_id', 'link_by', 'type', 'agenda', 'image'];
    
        public function user()
        {
            return $this->belongsTo('App\User','user_id','id');
        }
    
        public function courses()
        {
            return $this->belongsTo('App\Course','course_id','id');
        }
    }

#Controller

public function joinMeetup($meetingid){
        $userid = Auth::user()->id;
        
        $jitsimeetings = JitsiMeeting::where([
            ['user_id', '=', $userid],
            ['meeting_id', '=', $meetingid]
        ])->get();
        
        return view('admin.jitsimeeting.jitsimeet', compact('jitsimeetings'));
    }

#View

<?php foreach($jitsimeetings as $key => $meeting){} ?>

<div class="container-fluid">
    <div id='meet'></div>
</div>
<script src='https://meet.jit.si/external_api.js'></script>
<!-- <script src='https://localhost/external_api.js'></script> -->
<script>

const domain = 'meet.jit.si';
const options = {
    roomName: <?php echo $meeting->meeting_id; ?>,
    width: 1250,
    height: 700,
    parentNode: document.querySelector('#meet'),
    userInfo: {
            displayName: '<?php echo $meeting->meeting_title; ?>'
            
        },
    // jwt: '<jwt_token>',
    

    configOverwrite:{
            // doNotStoreRoom: true,
            // startVideoMuted: 0,
            startWithVideoMuted: true,
            startWithAudioMuted: true,
            // liveStreamingEnabled: true
            // desktopSharingFrameRate: {
            // min: 5,
            // max: 5
            // },
            enableWelcomePage: false,
            prejoinPageEnabled: false,
            enableSaveLogs: false,
            enableNoisyMicDetection: true
            // disableRemoteMute: false
            
        },
    interfaceConfigOverwrite: {
            // filmStripOnly: false,
            SHOW_JITSI_WATERMARK: false,
            SHOW_WATERMARK_FOR_GUESTS: false,
            SHOW_BRAND_WATERMARK: false,
            SHOW_POWERED_BY: false
            //  DEFAULT_REMOTE_DISPLAY_NAME: 'New User'
            // TOOLBAR_BUTTONS: []
        }
};
const api = new JitsiMeetExternalAPI(domain, options);
api.executeCommand('subject', '<?php echo $meeting->meeting_title; ?>');

</script>

Solution

  • You have closed foreach at the begining so

        <!-- <script src='https://localhost/external_api.js'></script> -->
    
        <script>
    
     @foreach($jitsimeetings as $key => $meeting)
    
        <div class="container-fluid">
            <div id='meet'></div>
        </div>
      
    
            const domain = 'meet.jit.si';
            const options = {
                roomName:'{{$meeting->meeting_id}}' ,
                width: 1250,
                height: 700,
                parentNode: document.querySelector('#meet'),
                userInfo: {
                    displayName: '{{$meeting->meeting_title}}'
    
                },
                // jwt: '<jwt_token>',
    
    
                configOverwrite:{
                    // doNotStoreRoom: true,
                    // startVideoMuted: 0,
                    startWithVideoMuted: true,
                    startWithAudioMuted: true,
                    // liveStreamingEnabled: true
                    // desktopSharingFrameRate: {
                    // min: 5,
                    // max: 5
                    // },
                    enableWelcomePage: false,
                    prejoinPageEnabled: false,
                    enableSaveLogs: false,
                    enableNoisyMicDetection: true
                    // disableRemoteMute: false
    
                },
                interfaceConfigOverwrite: {
                    // filmStripOnly: false,
                    SHOW_JITSI_WATERMARK: false,
                    SHOW_WATERMARK_FOR_GUESTS: false,
                    SHOW_BRAND_WATERMARK: false,
                    SHOW_POWERED_BY: false
                    //  DEFAULT_REMOTE_DISPLAY_NAME: 'New User'
                    // TOOLBAR_BUTTONS: []
                }
            };
            const api = new JitsiMeetExternalAPI(domain, options);
            api.executeCommand('subject', '{{$meeting->meeting_title}}');
    
        </script>
        @endforeach