PHPackages                             mach3builders/laravel-privatelabel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mach3builders/laravel-privatelabel

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mach3builders/laravel-privatelabel
==================================

Add private label functionality to mach3laravel applications

v2.2(2y ago)0175MITPHPPHP ^8.1

Since Nov 3Pushed 1y ago9 watchersCompare

[ Source](https://github.com/mach3builders/laravel-privatelabel)[ Packagist](https://packagist.org/packages/mach3builders/laravel-privatelabel)[ Docs](https://github.com/mach3builders/laravel-privatelabel)[ RSS](/packages/mach3builders-laravel-privatelabel/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (9)Dependencies (8)Versions (12)Used By (0)

Add private label functionality to mach3laravel applications
============================================================

[](#add-private-label-functionality-to-mach3laravel-applications)

This package is designed for the `laravel-starter`. It presupposes that your project was initiated using the `laravel-starter` template.

Installation
------------

[](#installation)

Install the package via composer:

```
composer require mach3builders/laravel-privatelabel
```

Publish and execute migrations:

```
php artisan vendor:publish --provider="Mach3builders\PrivateLabel\PrivateLabelServiceProvider" --tag="privatelabel-migrations"
```

Publish the configuration file:

```
php artisan vendor:publish --provider="Mach3builders\PrivateLabel\PrivateLabelServiceProvider" --tag="privatelabel-config"
```

Here's the published configuration file:

```
return [
    /**
     * The owner model of the private label
     */
    'owner_model' => App\Models\Account::class,

    /**
     * The layout the extend the views off
     */
    'extend_layout' => 'privatelabel::layout',

    /**
     * Middleware the private label route should live under
     */
    'middleware' => ['web', 'auth', 'locale'],

    /**
     * The prefix used inside the route group
     */
    'route_prefix' => 'app',

   /**
     * The domain that runs the main app this is used for the nginx template
     */
    'main_domain' => env('PRIVATE_LABEL_MAIN_DOMAIN'),

    /**
     * The domain every label needs to be cnamed to
     */
    'domain' => env('PRIVATE_LABEL_DOMAIN'),

    /**
     * Forge information
     */
    'forge' => [
        'api_token' => env('FORGE_API_TOKEN'),
        'server_id' => env('FORGE_SERVER_ID'),
        'server_ip' => env('FORGE_SERVER_IP'),
    ],

    /**
     * Forge information
     */
    'mailgun' => [
        'api_token' => env('MAILGUN_API_TOKEN', ''),
    ],
];
```

Add the following variables to your .env file:

```
PRIVATE_LABEL_DOMAIN=
FORGE_SERVER_ID=
FORGE_API_TOKEN=
FORGE_SERVER_IP=
MAILGUN_API_TOKEN=
```

Migrate the database

```
php artisan migrate
```

Usage
-----

[](#usage)

### Navigation

[](#navigation)

Include the index route in your menu:

```

            {{ __('Private label') }}

```

### PHP

[](#php)

Incorporate this trait into your owner model as specified in the config:

```
use Mach3builders\PrivateLabel\Traits\HasPrivateLabel;

use HasPrivateLabel;
```

### JavaScript

[](#javascript)

Insert this snippet into your `app.js`:

```
import "@mach3builders/ui/dist/js/plugins/poller";

$(".private-label-poller").poller({
    running: function (target, data) {
        switch (data.current_status) {
            case "dns_validating":
                $("#dns_validating").removeClass("d-none");
                $("#dns_validated").addClass("d-none");
                break;

            case "dns_validated":
                $("#dns_validating").addClass("d-none");
                $("#dns_validated").removeClass("d-none");
                break;

            case "site_installing":
                $("#site_installing").removeClass("d-none");
                $("#site_installed").addClass("d-none");
                break;
        }
    },
    done: function (target, data) {
        $("#site_installing").addClass("d-none");
        $("#site_installed").removeClass("d-none");
    },
});
```

### Brand Customization

[](#brand-customization)

To easily manage brand-specific elements like logos and favicons, use this `Brand.php` template:

```
