如何在PHP中自定义Laravel-5中的代码

I want to transform this code for laravel blade template <?php echo ($page=="menu" ? "header-active" : "")?>

i have code in Php to make header menu.

<ul class = "menu-container">
        <li class="header-hover <?php echo ($page=="home" ? "header-active" : "")?>">
            <a href="{{URL::to('/')}}"><div class="menu">HOME</div></a>            </li>
        <li class="header-hover <?php echo ($page=="menu2" ? "header-active" : "")?>">
            <div class="menu">Menu 2</div>
            <ul class="in">
                <li><a href="{{URL::to('/menu2 A')}}">MENU 2A</div></a>            </li>
            </ul>
        </li>
    </ul>

Please Help me I get error : Undefined variable: page

Try the following -
{!!$page=="layanan" ? "header-active" : ""!!}.

Before that, make sure you have installed laravelcollective/html

If not, Follow the below steps,

  1. add "laravelcollective/html": "5.1.*" in the require feild inside composer.json file in the root of the project.
  2. Run composer update from root of your project. This will install the package required for blade templating by laravel.
  3. In config/app.php, under providers add Collective\Html\HtmlServiceProvider::class.
  4. In config/app.php, under aliases add 'Form'=>Collective\Html\FormFacade::class and 'Html'=>Collective\Html\HtmlFacade::class.

Thankyou :)