A
A
Andrey Boychenko2016-04-22 22:08:55
Laravel
Andrey Boychenko, 2016-04-22 22:08:55

Do not put on crutches laravel5?

Good evening! Tell me how not to put on crutches? It is necessary to add .class to the menu block on all except the main page

<div class="navbar <? if( $_SERVER['REQUEST_URI'] !== '/' ) echo 'solid light' ?> ">

And this is in the template of one of the pages
<?
    if( $_SERVER['REQUEST_URI'] !== '/' )
    {
        echo '<div class="offset" style="padding-top: 90px;"></div>';
    }
    ?>

How not to put on crutches? Yes, and everything else will be a problem by adding a class to the block when using pagination ...
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WebDev, 2016-04-22
@Ka4_Piton

Normal option. And to avoid problems with pagination, use not $_SERVER['REQUEST_URI'], but the name of the route. For example :

Route::get('/',  ['as' => 'base',    'uses' => '[email protected]']);

if (request()->route()->getName() != 'base')) { ... }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question