Skip to content

Artisan Console Commands ​

This package provides some artisan commands in order to manage and publish its resources. These commands are explained in the following sections. First, we are going to describe a summary of the available resources and their installation target. The resources are distinguished by a key name and some of they are required by this package, they are listed below:

NOTE

A package resource is a set of files this package can copy into your project (the assets, the configuration file, the views, …). Every one of them is identified by a key, and that key is the value you pass to the --only=, --with= options and to the adminlte:remove command.

The Package Resources ​

Required Resources: ​

  • assets: The AdminLTE v4 distribution files: the stylesheets (including the RTL and the extended colors variants), the scripts and the default logo image. The source maps and the adminlte-docs.css stylesheet of the upstream distribution are left out, since nothing of the package serves them.

    Target: The assets will be installed inside the public/vendor/adminlte folder of your Laravel project.

  • config: The package configuration file.

    Target: The config/adminlte.php file will be published on your project.

  • translations: The set of translations files used by the package.

    Target: The translations files will be published in the lang/vendor/adminlte/ folder of your Laravel project.

Optional Resources: ​

  • vendor_assets: The third party assets that AdminLTE v4 requires at runtime but does not distribute: the Bootstrap JavaScript bundle, the Bootstrap Icons font, OverlayScrollbars and the Source Sans 3 web font. They are published from the node_modules folder of your project, so install them first with npm i bootstrap@^5.3 bootstrap-icons@^1.13 overlayscrollbars@^2.11 @fontsource/source-sans-3@^5.3. When they are not available, the resource is skipped and the package falls back to the CDN locations defined on the assets configuration.

    Target: The assets will be installed inside the public/vendor/bootstrap, public/vendor/bootstrap-icons and public/vendor/overlayscrollbars folders of your Laravel project.

  • auth_views: A set of AdminLTE styled authentication views to replace the ones provided by the legacy laravel/ui package. Six files are written (login, register, verify, passwords/confirm, passwords/email and passwords/reset), and each one is a one-liner extending the related package view, so a package update reaches them without republishing.

    Target: The authentication views will be published inside the resources/views/auth folder of your Laravel project.

  • auth_routes: The routes definitions needed for the authentication scaffolding provided by the legacy laravel/ui package.

    Target: The routes will be inserted in the routes/web.php file of your Laravel project.

  • main_views: The set of blade views that, in conjunction, defines the main layout you usually will extend. You may publish this resource if you need to make some customization on the provided template layout. It covers the master.blade.php and page.blade.php files, the whole partials/ folder, the plugins.blade.php file and the auth/ views. Note it deliberately leaves the components/ folder out, that one belongs to the components resource.

    Target: The main views will be published in the resources/views/vendor/adminlte/ folder of your Laravel project.

  • components: The set of blade components provided by this package. You may publish this resource if you need to make a customization in any of the available components.

    Target: The components views will be published in the resources/views/vendor/adminlte/components/ folder of your Laravel project, and the components classes will be published in the app/View/Components/Adminlte/ folder.

  • error_views: The set of AdminLTE styled error views (401, 403, 404, 419, 429, 500 and 503). Each published file is a one-liner that extends the related package view, so a package update reaches your error pages without republishing them. Publishing it replaces the error pages your application may already have, so only the full installation type includes it.

    Target: The error views will be published in the resources/views/errors/ folder of your Laravel project, which is where Laravel looks for them.

The adminlte:install Command ​

You can install all the required and some additional package resources using the php artisan adminlte:install command. Without any options it will install the AdminLTE package assets, the configuration file and the translations. For the installation of additional resources check the available command options.

Command Options ​

  • --force: Use this option to force the overwrite of any existing files during the installation process.

  • --type=: Use this option to set the installation type, the available types are: basic (the default value, which installs the assets, vendor_assets, config and translations resources), basic_with_auth (a basic installation plus the auth_views and auth_routes resources), basic_with_views (a basic installation plus the main_views resource) or full (a basic installation plus the auth_views, auth_routes, main_views, components and error_views resources).

  • --only=*: Use this option to install only specific resources, the available resources are: assets, vendor_assets, config, translations, auth_views, auth_routes, main_views, components or error_views. It can not be combined with the --type and the --with options: when --only is present the command installs exactly what it lists and the other two are ignored, without any warning. Also, you can use this option multiple times, for example:

    sh
    php artisan adminlte:install --only=config --only=main_views
  • --with=*: Use this option to install with additional resources, the available resources are: vendor_assets, main_views, auth_views, auth_routes, components or error_views. This option can be used multiple times, examples:

    sh
    php artisan adminlte:install --with=auth_views --with=auth_routes
    php artisan adminlte:install --with=main_views
  • --interactive: Use this option to allow be guided through the installation process and choose what you want to install.

IMPORTANT

When you are upgrading an existing project from a 3.x release, the main_views, auth_views and components resources must be re-published with --force. Their AdminLTE v3 (Bootstrap 4) markup does not render correctly on AdminLTE v4. See the Upgrading from 3.x page.

The adminlte:remove Command ​

You can uninstall or remove an already published package resource using the php artisan adminlte:remove {resource}... command. The command will accept one or more resource names as its arguments. Examples:

sh
# Remove the published main_views resource.
php artisan adminlte:remove main_views

# Remove multiple resources.
php artisan adminlte:remove main_views auth_views components

Command Arguments ​

  • resource: One or more resource keys to remove, at least one is required. The accepted keys are the ones listed on The Package Resources section: assets, vendor_assets, config, translations, auth_views, auth_routes, main_views, components and error_views.

Command Options ​

  • --force: Use this option to force the removal of a package resource, avoiding confirmations.

  • --interactive: Use this option to allow be guided through the process.

The adminlte:plugins Command ​

If you won't use a content delivery network (CDN) to include the extra plugins, you can manage them locally with the php artisan adminlte:plugins command.

IMPORTANT

AdminLTE v4 does not bundle any third party plugin any more (the AdminLTE v3 plugins/ folder is gone). The plugins catalogue of this command now publishes the AdminLTE v4 recommended, jQuery free libraries from the node_modules folder of your project, so you have to install the related npm package first. When a package is missing, the command tells you the exact npm i command to run. The AdminLTE v3 plugin keys are still recognized and the command reports their v4 replacement.

You can list, install or remove all the available plugins at once or some specifics plugins. It is recommended to first check which plugins are available by executing the command php artisan adminlte:plugins (the output of this command is similar to the one explained for the adminlte:status command). Note that after a plugin is installed locally, you still need to setup it on the configuration file in order to use it, refer to the Plugins section to checkout how to configure a plugin. Here are some examples that helps to explain the command options:

  • List the status of all the available plugins:
    sh
    php artisan adminlte:plugins
    php artisan adminlte:plugins list
  • List the status of the specified plugins:
    sh
    php artisan adminlte:plugins --plugin=flatpickr --plugin=tomSelect
  • Install all the available plugins:
    sh
    php artisan adminlte:plugins install
  • Install only the Flatpickr & Quill plugins:
    sh
    php artisan adminlte:plugins install --plugin=flatpickr --plugin=quill
  • Remove all the available plugins:
    sh
    php artisan adminlte:plugins remove
  • Remove only the Quill plugin:
    sh
    php artisan adminlte:plugins remove --plugin=quill

Command Arguments ​

  • operation: The type of the operation to execute: list (default), install or remove.

Command Options ​

  • --plugin=*: Use this option to apply the operation only over the specified plugins, the value of the option should be a plugin key. The option can be used multiple times.
  • --force: Use this option to force the overwrite of existing files.
  • --interactive: Use this option to enable be guided through the operation process and choose what you want to do on each step.

The adminlte:update Command ​

This command takes no arguments and no options. It is a shortcut for php artisan adminlte:install --force --only=assets, extended with two conveniences:

  • When the optional vendor_assets resource was previously published, it is refreshed too, so the command becomes php artisan adminlte:install --force --only=assets --only=vendor_assets. When it was never published, it is left alone (the package falls back to the CDN for those resources).

  • When the main_views resource was previously published and it differs from the one currently provided by the package, the command prints a warning telling you that your published layout views are outdated and may require a manual update.

NOTE

This command only updates the assets located on the public/vendor folder. It will not update any other package resource (the configuration file, the translations or the published views), refer to section Updating to check how to make a complete update.

The adminlte:status Command ​

This command is very useful to check the package resources installation status, to run it execute the command:

sh
php artisan adminlte:status

It takes no arguments and no options.

Once completed, it will display a table with all the available package resources and they installation status. The status can be one of the nexts:

  • Installed: This means that the resource was published/installed and exactly match with the original resource provided by the package.

  • Mismatch: This means that the resource was published but mismatches with the original resource provided by the package. This can happen due to an update available or when you have made some local customization or change on the published resource.

  • Not Installed: This means that the package resource is not installed or published.

The table also shows a column which tells what resources are required for the package to work correctly. So, for these resources you should read Installed or Mismatch on the status column, otherwise the package won't work.