jeudi 13 octobre 2016

Laravel if request on view (with help from route)?

I do the request on view because I want to disable some parts and for some pages:

@if (\Request::route()->getName() != 'product.show')

This works, but my question is, can I set a additional parameter on my route to make my script more flexibile, something like:

My route code is:

Route::get('/product/{slug}', ['uses' => 'ProductController@show', 'NO_SIDEBAR_PARAM' => 'true'], function ($slug) {
    return [$slug];
})->name('product.show');

So I want to create if request on "NO_SIDEBAR_PARAM" if is set to "true" or "false" to enable or disable elements.

Is the way correct?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire