›
byrcsc/laravel-whitelabel · 1.x
Render the active brand's logo, favicon, and colours in Blade layouts.
Use the included Blade components when a layout needs the active brand's visual identity. Each component reads the active brand and renders nothing when its required value is absent.
Place the styles component in the document head:
<x-whitelabel::styles />For a brand with primary and secondary colours, it emits:
:root {
--brand-primary: #7c3aed;
--brand-secondary: #0ea5e9;
}The configured prefix comes from whitelabel.css.prefix. Override it for one
render:
<x-whitelabel::styles prefix="theme" nonce="{{ $nonce }}" />Other attributes are forwarded to the <style> element. Invalid CSS variable
names are dropped. Characters that could end a declaration, block, or comment
are removed from values.
<x-whitelabel::logo class="h-8" id="site-logo" />The component renders an <img> with the active brand's logo URL. Its alt
text defaults to the brand name:
<x-whitelabel::logo alt="Dashboard home" />Attributes merge onto the image tag. A brand with no logo after fallback renders no tag.
<x-whitelabel::favicon />The component guesses type for ico, png, svg, gif, jpg, jpeg, and
webp paths. Unknown extensions omit the type attribute. Override it when the
URL does not reveal the format:
<x-whitelabel::favicon type="image/png" />Attributes override defaults, so an Apple touch icon can reuse the component:
<x-whitelabel::favicon rel="apple-touch-icon" sizes="180x180" />Use the helper for text and application settings:
<title>{{ brand('name', config('app.name')) }}</title>
@if ($supportUrl = brand('settings.support_url'))
<a href="{{ $supportUrl }}">Support</a>
@endifCalling brand() without a key returns the active Brand or null:
@if ($brand = brand())
<meta name="theme-color" content="{{ $brand->color('primary', '#111827') }}">
@endifPublish the three views when the generated tags need different markup:
php artisan vendor:publish --tag=whitelabel-viewsFiles under resources/views/vendor/whitelabel override the package views.
Publishing creates an application-owned copy that will not receive later
package view changes automatically.