blade conditional help

Posted 1 year ago by madsynn

Can anyone tell me why these will not work? I have tried them all and to no avail. I am trying to only show code if the view is part of the blog.

@if(Request::is() === '/en/resources/blog/')
<h1>this is a blog article</h1>
 @else
    // duh not working
@endif

@if(Request::is() === '/en/resources/blog/')
     @include('frontend.article.partials.temp')
      @else
    // duh not working
@endif


@if(Request::path() == '/en/resources/blog/')
    <h1>article for the blog</h1>
     @else
    // duh not working
@endif

@if(Request::path() === '/en/resources/blog/home-use')
    // code
    @else
    // duh not working
@endif 

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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.