Mirich
Mirich

Reputation: 351

Not working Request::is() in Laravel

I faced the problem with the use of Request::is() function which is used with if statement that ensures that div with jumbotron is shown only in /home request in a view and as you can see in the code below basically all is good but when I go to /home div with jumbotron is not shown at all thus I really need your help The code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link href={{asset("css/app.css")}} rel="stylesheet">
</head>
<body>
    @include('navbar')

        <div class="container">
                @if(Request::is('/home'))
                <div class="jumbotron text-center">
                        <h1>Welcome to our website</h1>                       
                    </div>
                @endif
  <div class="row">
        <div class="col-md-8 col-lg-8">
     @yield('content')
     </div>

        <div class="col-md-4 col-lg-4 card">
    @yield('sidebar')
</div>
</div>
    </div>


</body>
</html>

Upvotes: 0

Views: 924

Answers (1)

lagbox
lagbox

Reputation: 50531

Request::is('home');

The slash is not part of the path in this regard.

Upvotes: 4

Related Questions