PHP code example of mach3builders / laravel-privatelabel
1. Go to this page and download the library: Download mach3builders/laravel-privatelabel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mach3builders / laravel-privatelabel example snippets
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', ''),
],
];
use Mach3builders\PrivateLabel\Traits\HasPrivateLabel;
use HasPrivateLabel;
namespace App;
class Brand
{
public static function name()
{
return label()->name
?? config('app.name', 'Mach3Builders');
}
public static function logoLight()
{
return optional(label())->hasMedia('logo_light')
? label()->getFirstMediaUrl('logo_light')
: config('brand.logo_light');
}
public static function logoDark()
{
return optional(label())->hasMedia('logo_dark')
? label()->getFirstMediaUrl('logo_dark')
: config('brand.logo_dark');
}
public static function logoLoginHeight()
{
return optional(label())->hasMedia('logo_dark')
? label()->logo_login_height
: config('brand.logo_login_height');
}
public static function logoAppHeight()
{
return optional(label())->hasMedia('logo_light')
? label()->logo_app_height
: config('brand.logo_app_height');
}
public static function favicon()
{
return optional(label())->hasMedia('favicon')
? label()->getFirstMediaUrl('favicon')
: config('brand.favicon');
}
public static function registration()
{
return config('brand.registration');
}
}
public string $domain;
public string $name;
public string $email;
public string $logo_login_height; // should be used together with the logo_login
public string $logo_app_height; // should be used together with the logo_app
public string $status; // has one of the following statusses
protected $statusses = [
'dns_validating',
'dns_validated',
'site_installing',
'site_installed',
];
function boot()
{
// ...
return Gate::define('viewPrivateLabel', function ($user, $owner_id) {
return app()->environment(['local', 'testing']);
});
// ...
}
public function owner()
public function registerMediaCollections(): void
{
$this->addMediaCollection('logo_light')->singleFile();
$this->addMediaCollection('logo_dark')->singleFile();
$this->addMediaCollection('favicon')->singleFile();
}