›
›
›
  1. docs
  2. ›
  3. byrcsc/laravel-whitelabel
1.x
Browse documentationOpenClose

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Brand definitions
  • Fallback and clearing
  • Brand resolution
  • Brand repositories

Using brands

  • Blade components
  • Mail and notifications
  • Queues
  • Spatie Multitenancy

Operations

  • Manage database brands
  • Custom drivers and resolvers
  • Events and listeners
  • Cache management

Reference

  • Configuration
  • Public API
  • Console commands
  • Testing
  • Troubleshooting

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Brand definitions
  • Fallback and clearing
  • Brand resolution
  • Brand repositories

Using brands

  • Blade components
  • Mail and notifications
  • Queues
  • Spatie Multitenancy

Operations

  • Manage database brands
  • Custom drivers and resolvers
  • Events and listeners
  • Cache management

Reference

  • Configuration
  • Public API
  • Console commands
  • Testing
  • Troubleshooting

byrcsc/laravel-whitelabel · 1.x

Blade components.

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.

Render colour variables

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.

Render a logo

<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.

Render a favicon

<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" />

Read values without a component

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>
@endif

Calling brand() without a key returns the active Brand or null:

@if ($brand = brand())
    <meta name="theme-color" content="{{ $brand->color('primary', '#111827') }}">
@endif

Override component markup

Publish the three views when the generated tags need different markup:

php artisan vendor:publish --tag=whitelabel-views

Files under resources/views/vendor/whitelabel override the package views. Publishing creates an application-owned copy that will not receive later package view changes automatically.

What to read next

  • Brand definitions for asset and colour value shapes.
  • Mail and notifications to brand Laravel Markdown mail.
  • Troubleshooting when a component renders nothing.
PreviousBrand repositoriesNextMail and notifications
View source

On this page

  1. Render colour variables
  2. Render a logo
  3. Render a favicon
  4. Read values without a component
  5. Override component markup
  6. What to read next