Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Hide a video player if there is no data in database

How do I hide a video player if there is no data to be displayed?
enter image description here

Do I need to use javascript for it?

Here is the code for displaying the video player:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

        <div id="video-player"> 
        <video width="100%"controls> 
            <source src="{{ asset('workmedia/' . $artpiece->art_vid) }}" type="video/mp4"> 
              Your browser does not support the video tag. 
        </video> 
      </div>

>Solution :

Use the @isset blade directive to determine if your $artpiece->art_vid has a value and if it does, display the video otherwise don’t:

@isset($artpiece->art_vid)
<div id="video-player"> 
        <video width="100%"controls> 
            <source src="{{ asset('workmedia/' . $artpiece->art_vid) }}" type="video/mp4"> 
              Your browser does not support the video tag. 
        </video> 
      </div>
@endisset
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading