Skip to content

Artisan Console Commands

Diego Smania edited this page Feb 25, 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, they are distinguished by a key name:

  • assets: The set of AdminLTE required assets, including dependencies like Bootstrap and jQuery.
  • config: The package configuration file.
  • translations: The set of translations files used by the package.
  • auth_views: A set of AdminLTE styled authentication views to replace the Laravel default ones.
  • basic_views: A home blade view that shows a basic template usage.
  • basic_routes: Routes definitions for the authentication scaffolding.
  • main_views: The set of package blade views that, in conjunction, provides the main layout you usually will extend.

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.

Authentication Views

Note: this is only available for Laravel 5.2 or higher versions.

Note: from Laravel 7, the authentication views are part of the laravel/ui package. So it is recommended to read Laravel Authentication Documentation before proceeding.

This package provides the following command to replace the Laravel default authentication views (those inside the folder resources/views/auth) with a set of AdminLTE styled views.

php artisan adminlte:install --only=auth_views

By default, the provided login view contains a link to the registration and password reset views. If you don't want a registration or password reset form, set the register_url or password_reset_url setting to null on the adminlte.php configuration file and the respective link will not be displayed.

5.5.1 Using the Authentication Views Manually

In case you want to use the package authentication views manually, you can create the following files and only add one line to each one of these files:

  • resources/views/auth/login.blade.php:
    @extends('adminlte::auth.login')
  • resources/views/auth/register.blade.php
    @extends('adminlte::auth.register')
  • resources/views/auth/verify.blade.php
    @extends('adminlte::auth.verify')
  • resources/views/auth/passwords/confirm.blade.php
    @extends('adminlte::auth.passwords.confirm')
  • resources/views/auth/passwords/email.blade.php
    @extends('adminlte::auth.passwords.email')
  • resources/views/auth/passwords/reset.blade.php
    @extends('adminlte::auth.passwords.reset')