Loading...

This is taking longer than expected.

Back

Configure the builder

The environment variables and config keys the website layer adds, and the add-on that opens the page editor.

The website layer is configured by a few keys on top of the ones Teams and the base already read. Configure those first — Configure teams and The environment file — then the ones below.

APP_URL decides which domain is yours

APP_URL is more than the root of your links here. Its host is the application's own domain: the only one where the admin panel, /app, the home page and the feature pages answer. Any other host that reaches the application is read as the address of a team's site. Set it to the exact host you serve, without www.:

APP_URL=https://builder.example.com

A request to a host that matches no team is sent back to APP_URL with ?error=site_not_configured. How a host becomes a team is explained in The public site.

Environment variables

Variable Default What it does
CLOUD_FLARE_TOKEN empty Cloudflare API token that creates and deletes the CNAME record of each free subdomain. It is read by config/services.php.
PLOI_API_KEY empty Ploi API key that adds each free subdomain to your site on Ploi and requests its certificate.
PLOI_SERVER_ID empty The Ploi server that runs the application.
PLOI_SITE_ID empty The Ploi site that answers for every team's domain. Each free subdomain is added to it as a tenant.
MULTIMEDIA_ENABLE_MASK false With true, a team's site serves the files of its library under its own domain, at /media/.... With false that route answers 404.

Without the Cloudflare and Ploi values the rest of the builder keeps working: a team can still save a free subdomain, but no DNS record, server entry or certificate is created for it. With them, those are created only for a free subdomain that has a domain record, and today no screen creates that record. See Domains and SSL.

config/app.php

'project' => 'weblabor-builder',

'available_domains' => [
    ['domain' => 'example.com', 'zone_id' => 'your-cloudflare-zone-id'],
    ['domain' => 'example.net', 'zone_id' => 'another-zone-id'],
],
Key What it does
project The folder this help centre and the feature pages are read from. Change it when your product gets its own name, and copy the folders with it.
available_domains The base domains a team can take a free subdomain of, each with the id of its Cloudflare zone. A team picks one in the domain selector; the zone id is where its CNAME record is written. The kit ships with Weblabor's own domains in this list: replace them with yours.

The page editor is an add-on

Writing pages is checked against the team's add-ons under the feature key pages, through the same $team->hasFeature() Teams uses for any capability. A team that has it creates, edits and backs up its pages at /team/pages. A team that does not is refused every page action, and its site shows the pages of the default theme instead of its own, so it is never left blank.

The keys a team can be sold are the public methods of App\Classes\TeamPlanFeatures, and the kit ships that class empty. To sell the editor, or include it in a plan, declare it there:

namespace App\Classes;

class TeamPlanFeatures extends BasePlanFeatures
{
    public function pages()
    {
        return true;
    }
}

Then create the add-on in the admin panel with pages as its feature, and attach it to the plans that include it. How add-ons are priced and granted is Sell add-ons on the base's site; how they attach to a team is Team plans and billing on the Teams site.

Switches each team flips itself

Forms and custom fields are not configured by you: each team turns them on under Features in /team/settings. See Site settings and visitors.

The permissions the website layer adds

The page, form, entry, custom field and visitor screens are resources on the team guard, and their permissions are generated from them: retrieve page, create page, update page, delete page, and the same four verbs for form, form_entry, form_entry_input, custom_field and team_visitor where the screen allows the action. form_entry_input decides who reads the fields of an entry. Generate them after installing, and again after adding a resource of your own:

php artisan db:seed --class=PermissionSeeder

A team's owner role receives every team permission that exists when the team is created. Give them to other roles from /team/roles, as Team roles and permissions explains.

The queue

A new team's default pages, and every step of a free subdomain's provisioning, when it runs — the server entry, the certificate request and the certificate check — run as queued jobs. Keep a queue worker running, as Deploy your project describes, or those steps wait.