Domain

Definition

A domain is a universe in which data can be partitioned. Domains can be used to manage multiple companies in the same Uccello application or to create a business application in which your customers will only have access to data about them.

It is possible to create a domain tree to prioritize domains and make it easy to view all the data contained in the subdomains.

Uccello uses the library gzero/eloquent-tree to easily manage the domain tree.

Slug

Uccello use the library cviebrock/eloquent-sluggable to generate unique identifier for each domain. A slug allows to retrieve a domain from an URL. A slug is generated from a domain's name.

For example the slug of the domain called Uccello is uccello and the slug of the domain called My Company is my-company.

As slugs are uniques, if several domains have the same name, their slugs will be different (e.g. uccello, uccello-1).

When a domain is renamed, its slug is automatically regenerated.

Multi-domain or not?

Multi-domain management is enabled by default in Uccello, but it can be easily disabled to meet the needs of small projects.

To disable multi-domain management, add the following to the .env file of your application:

UCCELLO_MULTI_DOMAINS=false

After each activation or deactivation of the multi-domain management, remember to clear the cache:

php artisan cache:clear
php artisan route:clear # only if you cache the routes

With multi-domain

Routes

When multi-domain is enabled, all the default routes contains the current domain's slug.

/uccello/user/detail?id=1
/acme/person/list
/aguapassion/invitation/edit

The advantages of using the domain's slug in the URL are:

  • You can easily share a URL and it will point to the right data in the right domain.

  • You can easily work on different domains by opening several tabs in your browser.

You can easily view the current domain name in the header.

By clicking on it, a modal opens and displays the domain tree. This allows you to easily switch to another domain.

The Security submenu, available in the Settings Panel, display a link to access to the domain module.

Descending view

Thanks to Roles, you can allow user to activate Descending view. This option allows users to see data contained in the current domain and all its subdomains.

When multi-domain is enabled, if the user is authorized to do it, a button is displayed in the List View. By activating it, the user can view the data of the subdomains, in addition to the current domain.

If the module contains a field called domain with the Entity Uitype , the corresponding column is showed automatically in the List View when Descending view option is activated.

Without multi-domain

Routes

For projects that do not need a multi-domain, it can be cumbersome to have the domain slug that appears in all URLs. This is why when multi-domain management is disabled, no route contains the domain slug:

/user/detail?id=1
/person/list
/invitation/edit

To facilitate management, if multi-domain management is disabled, Uccello assigns the data to the first active domain found in the database. So, if you decide to activate multi-domain management later, everything will work normally!

Header

When multi-domain is disabled, the header does not display the current domain and the modal for switching between domains.

The Security submenu, available in the Settings Panel, does not display link to access to the domain module.

Descending view

When multi-domain is disabled, the Descending view button is not displayed in the List View.

Overpass domain filtering

Data filtering by domain is done automatically thanks to the Query Scope inDomain. This filter is activated if a domain_id column is present in the database table related to the module.

Sometimes it may be useful to create data that can be accessible across all domains, such as the list of countries for example. To do this, simply do not create a domain_id column in the database table related to the module. The Query Scope inDomain will then not be applied.

Last updated