Changing livewire layout dynamically

I am working on a CMS like multi-tenant app , that the templates differs per website/tenant.
I don’t know how to extend livewire layout view not to use layouts\app.blade.php and instead use tenant app selected layout located in layouts\ themename\app.blade.php

The themename is dynamic (gotten from the tenant theme settings stored in the DB).

How do i dynamically use an app layout per theme in livewire?

Currently in livewire this have to be hardcoded the the route\web.php?

// Customizing layout
Route::livewire('/home', 'counter')

Is there a way to make this dynamic?

Route::livewire is just a shortcut for Route::get. You might think about nesting your primary livewire component within another blade file and use @extend within that blade file to determine which layout you want to use. You can pass down a variable and extend your layout based on that.

lets imaging you have a base.blade.php and want to make it dynamic depend on the value in your DB.

first in you base.blade.php use the extended directive

  @php($theme = Theme::all());


this is the base idea and you can customize it depend on your needs

1 Like

Thanks @shortbrownman, was just hoping that there was a livewire way to do this