dimanche 3 juin 2018

How to check if variable is empty in laravel?

I have this code in my view file:

                        @if(!empty($slug))
                            dd(11);
                        <a href="" class="latest-heading">..</a>

                        @else
                        dd(22);
                        <a href="" class="latest-heading">..</a>
                        @endif

I have one post that has data in the slug database table column. The other posts do not. They have data only in the url column. But at the moment, I am seeing dd(22) next to each post. The post with data in the slug column has the slug in its URL structure. The other posts do not have anything their URLs. Their URL is website.com/articles

Any ideas?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire