Support the ongoing development of Laravel.io →
posted 10 years ago
Views
Last updated 2 years ago.
0

maybe using a view composer :)

Last updated 2 years ago.
0

DrPrez said:

/**
* Replace the if statement to whatever you need
**/
@if($thisPage != 'myOnePageName')
   @yield('task_panel')
@endif

Is there a way to get the page name or are you just talking about manually putting the page name into the view in your controller?

Last updated 2 years ago.
0

Hi realdeal64,

You could use the following sample code for get the view name:

View::composer('*', function($view){
    View::share('viewName', $view->getName());
});

You use * for sharing with all routes.

Later you can use the viewName variable in all views getting a different view name for each view.

Put this sample code into the filters.php file.

Hope it helps you.

Last updated 2 years ago.
0

That is an awesome idea thanks!

Last updated 2 years ago.
0

realdeal64 said:

That is an awesome idea thanks!

Thanks also for the @rcrocks reply, he told you here the same solution. I only expose some sample code.

rcrocks said:

maybe using a view composer :)

Hope this helps you.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.