Skip to content

Artisan Console Commands

Diego Smania edited this page May 22, 2022 · 18 revisions

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

Required Resources:

  • assets: The set of assets required by the AdminLTE package, including the AdminLTE package distribution files and his dependencies, like Bootstrap, jQuery and Font Awesome.

    Target: The assets will be installed inside the public/vendor 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 resources/lang/vendor/adminlte/ folder of your Laravel project (or in lang/vendor/adminlte folder for Laravel version >= 9.x).

Optional Resources:

  • auth_views: A set of AdminLTE styled authentication views to replace the ones provided by the legacy laravel/ui package.

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

  • basic_views: A very basic view that may be used as reference for the template usage.

    Target: The blade view will be installed in the resources/views/home.blade.php file of your Laravel project.

  • basic_routes: The routes definitions for the authentication scaffolding and the basic home view.

    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, provides the main layout you usually will extend. You may publish this resource if you need to make some customization on the provided template layout.

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

The adminlte:install Command

You can install all the required and some additional package resources using the php artisan adminlte:install command. Without any option it will install the AdminLTE package assets, the configuration file and the translations. You can also install the package Authentication Views adding the --type=enhanced option, or additional to the Authentication Views also the package Basic Views and Routes adding the --type=full option to the command.

Command Options

  • --force: Use this option to force the overwrite of any existing files by default.

  • --type=: Use this option to set the installation type, the available types are: basic (the default value), enhanced or full.

  • --only=*: Use this option to install only specific resources, the available resources are: assets, config, translations, auth_views, basic_views, basic_routes or main_views. This option can not be used with the --with option. Also, you can use this option multiple times, for example:

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

    php artisan adminlte:install --with=auth_views --with=basic_routes
    php artisan adminlte:install --type=full --with=main_views
  • --interactive : Use this to enable be guided through the installation process and choose what you want to install.

The adminlte:plugins Command

If you won't use the content delivery network (CDN) to include new plugins, you are able to manage some optional plugins with the php artisan adminlte:plugins command. You can list, install or remove all the available plugins at once or some specifics plugins. It is recommended to first check wich plugins are available 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:
    php artisan adminlte:plugins
    php artisan adminlte:plugins list
  • List the status of the specified plugins:
    php artisan adminlte:plugins --plugin=datatables --plugin=select2
  • Install all the available plugins:
    php artisan adminlte:plugins install
  • Install only Pace Progress & Select2 plugins:
    php artisan adminlte:plugins install --plugin=paceProgress --plugin=select2
  • Remove all the available plugins:
    php artisan adminlte:plugins remove
  • Remove only Select2 plugin:
    php artisan adminlte:plugins remove --plugin=select2

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 is only a shortcut for php artisan adminlte:install --force --only=assets.

Note: this command will only update the AdminLTE assets located on the public/vendor folder. It will not update any other package resources, 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:

php artisan adminlte:status

Once complete, 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 is installed and matches with the package resource.

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

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

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