Yousef Altaf Yousef Altaf - 5 months ago 8
PHP Question

Laravel 4 check if current path in array do somthing

I am trying to add banner on all the pages except the home page

I try this

@if(Request::path() !== array('/', 'home'))
<div class="bannerImage">{{ HTML::image('images/fullimage3.jpg') }}</div>
@endif


and this

@if(Request::path() !== '/' or 'home')
<div class="bannerImage">{{ HTML::image('images/fullimage3.jpg') }}</div>
@endif


how can I do this?

thanks

Answer

I'm not an expert in Laravel but if it will be a plain PHP you can use:

@if(Request::path() !== '/' or Request::path() !== 'home')

or:

@if(in_array(Request::path(), array('/','home')) 
Comments