Skip to main content
Brands represent manufacturers or labels for your products. They help customers identify and filter products from their favorite manufacturers, and they give your storefront structured navigation (e.g., a “Shop by Brand” page or a brand filter in search results).

Model

The model used is Shopper\Models\Brand, which extends Shopper\Core\Models\Brand. The core model provides the business logic, relationships, scopes, and slug generation. The admin model adds media collections and conversions through Spatie MediaLibrary. The core model implements Shopper\Core\Models\Contracts\Brand and uses the HasSlug trait for automatic slug generation with collision handling, and the HasMediaCollections trait for config-driven media support.

Extending the Model

To add custom behavior, extend the admin model and update your configuration:
Update config/shopper/models.php:

Database Schema

Slug Generation

The HasSlug trait generates unique slugs automatically. When you set the slug attribute, the trait runs it through Str::slug() and appends an incrementing suffix (-1, -2, etc.) if a collision is detected. The trait also provides a findBySlug() static method:

Relationships

Products

A brand has many products. This is a standard HasMany relationship using the configured product model.
To get only published products for a brand (for storefront display):
With eager loading:

Query Scopes

Enabled Brands

The enabled scope filters brands where is_enabled is true. Use it for all storefront queries to exclude draft or hidden brands.

Status Management

The updateStatus() method provides a convenient way to toggle brand visibility:
You can also update the field directly:

Media

Brands support two media collections through Spatie MediaLibrary, using the same config-driven collection names as products. To add a brand logo:
To retrieve the logo URL with a specific conversion:
From a URL:

Creating Brands

To create a brand with a logo and SEO metadata:

Retrieving Brands

To get all enabled brands ordered by position:
To get brands that have at least one product, with product counts:
To find a brand by slug:
For navigation or filter dropdowns where you only need name and slug:

Metadata

The metadata JSON column lets you store additional custom data that doesn’t warrant its own database column:

Configuration

Disabling Brands

If you don’t need brands in your store, disable the feature in config/shopper/features.php:
When disabled, the brand menu item is hidden from the sidebar, brand-related routes are not registered, and brand selection is removed from product forms.

Permissions

The admin panel generates four permissions for brand management:

Components

To customize the admin UI for brand management:
This creates config/shopper/components/brand.php:

Storefront Example

This example shows a brand listing page and a brand detail page with its published products.

View Composer

For brands that appear in multiple views (header, footer, filters), use a View Composer to avoid repeating the query:
Register it in your AppServiceProvider: