Control the load order of modules
To make Shop register before Blog, give Shop a lower priority than Blog. The package registers the providers of the enabled modules in ascending priority order.
Set the priority
Section titled “Set the priority”Edit the priority field in the module.json of each module. A module without the field has priority 0.
{ "name": "Shop", "alias": "shop", "description": "", "keywords": [], "priority": 1, "providers": [ "Modules\\Shop\\Providers\\ShopServiceProvider" ], "files": []}{ "name": "Blog", "alias": "blog", "description": "", "keywords": [], "priority": 10, "providers": [ "Modules\\Blog\\Providers\\BlogServiceProvider" ], "files": []}Modules with the same priority load in the order the scan finds them.
Check the result
Section titled “Check the result”List the enabled modules by priority.
php artisan module:list --only=priorityThe first line is the module that loads first:
[Enabled] Shop ........ Modules/Shop [1][Enabled] Blog ........ Modules/Blog [10]To list the highest priority first, add --direction=desc. The command lists enabled modules only: a disabled module does not load.
Related
Section titled “Related”priorityin module.jsonmodule:list- Enable and disable modules
- How modules boot: where the sort happens, and the order of modules with equal priority