Skip to content

Artisan Console Commands

Diego Smania edited this page Mar 24, 2021 · 18 revisions

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

  • assets: The set of AdminLTE required assets, including 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 created on your project.

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

    Target: Translations will be installed in the resources/lang/vendor/adminlte/ folder of your Laravel project.

  • auth_views: A set of AdminLTE styled authentication views to replace the Laravel default ones.

    Target: Authentication views will be installed inside resources/views/auth folder of your Laravel project.

  • basic_views: A home blade view that shows a basic template usage.

    Target: The views will be installed in resources/views folder of your Laravel project.

  • basic_routes: Routes definitions for the authentication scaffolding.

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

  • main_views: The set of package blade views that, in conjunction, provides the main layout you usually will extend.

    Target: Main views will be installed 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 the 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 Options

  • operation: The type of the operation: list (default), install or remove.
  • --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 installed resource mismatch the package resource. This can happen due to an update available or when you have made some modifications on the installed resource.

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

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.