Download the PHP package mauro-pinheiro/laravel-adminlte without Composer
On this page you can find all versions of the php package mauro-pinheiro/laravel-adminlte. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mauro-pinheiro/laravel-adminlte
More information about mauro-pinheiro/laravel-adminlte
Files in mauro-pinheiro/laravel-adminlte
Package laravel-adminlte
Short Description Easy AdminLTE integration with Laravel
License MIT
Informations about the package laravel-adminlte
Easy AdminLTE integration with Laravel
This package provides an easy way to quickly set up AdminLTE v2 with Laravel 6. It has no requirements and dependencies besides Laravel, so you can start building your admin panel immediately. The package just provides a Blade template that you can extend and advanced menu configuration possibilities. A replacement for the make:auth
Artisan command that uses AdminLTE styled views instead of the default Laravel ones is also included.
- Requirements
- Installation
- Updating
- Usage
- The
make:adminlte
artisan command- Using the authentication views without the
make:adminlte
command
- Using the authentication views without the
- Configuration
- Menu
- Custom menu filters
- Menu configuration at runtime
- Active menu items
- Plugins
- Menu
- Translations
- Menu Translations
- Customize views
- Issues, Questions and Pull Requests
1. Requirements
- Laravel 6.0.x
- PHP >= 7.2
2. Installation
-
Require the package using composer:
- Install the package using the command (For fresh laravel installations):
You can use --basic to avoid authentication scaffolding installation
You can use --force to overwrite any file
You can also use --interactive to be guided through the process and choose what you want to install
3. Updating
-
To update this package, first update the composer package:
-
Then, we need to update the assets
If you using AdminLTE for Laravel 5.x and are upgrading Laravel 6 version, delete the folder adminlte inside your public/vendor folder.
And then use this command to publish new assets
-
If you have published and modified the default master, page views or login views, you will need to update them too.
Option 1:
- Make a copy of the views you modified.
-
Publish the views again, using
- Redo the modifications you did.
Option 2:
- Modify in the css, js and other assets location in the master and page views.
3.1 Breaking Changes
- Version 1.25.1 to 1.26 and up:
- Plugins configuration was modified, check the new usage here: Plugins
- Version 1.26 to 1.27 and up:
- iCheck plugin was replaced with icheck-bootstrap. If you use the iCheck assets, make sure to check/modify the asset location.
- Laravel 6 version moved the assets file. Check the locations.
- If you modified the default views, edit then fixing the assets injection.
4. Usage
To use the template, create a blade file and extend the layout with @extends('adminlte::page')
.
This template yields the following sections:
title
: for in the<title>
tagcontent_header
: title of the page, above the contentcontent
: all of the page's contentcss
: extra stylesheets (located in<head>
)js
: extra javascript (just before</body>
)
All sections are in fact optional. Your blade template could look like the following.
Note that you can also use @stack
directive for css
and javascript
:
You now just return this view from your controller, as usual. Check out AdminLTE to find out how to build beautiful content for your admin panel.
6. Configuration
After the installation, you will notice a adminlte.php file in you config folder.
Use it to configure the title, skin, menu, URLs etc. All configuration options are explained in the comments.
6.1 Menu
You can configure your menu as follows:
With a single string, you specify a menu header item to separate the items.
With an array, you specify a menu item. text
and url
or route
are required attributes.
The icon
is optional, you get an open circle if you leave it out.
The available icons that you can use are those from Font Awesome.
Just specify the name of the icon and it will appear in front of your menu item.
Use the can
option if you want conditionally show the menu item. This integrates with Laravel's Gate
functionality. If you need to conditionally show headers as well, you need to wrap it in an array like other menu items, using the header
option:
Adding a Search Input
It's possible to add a search input in your menu, using a menu item with the following configuration:
Custom Menu Filters
If you need custom filters, you can easily add your own menu filters to this package. This can be useful when you are using a third-party package for authorization (instead of Laravel's Gate
functionality).
For example with Laratrust:
And then add to config/adminlte.php
:
Menu configuration at runtime
It is also possible to configure the menu at runtime, e.g. in the boot of any service provider. Use this if your menu is not static, for example when it depends on your database or the locale. It is also possible to combine both approaches. The menus will simply be concatenated and the order of service providers determines the order in the menu.
To configure the menu at runtime, register a handler or callback for the MenuBuilding
event, for example in the boot()
method of a service provider:
The configuration options are the same as in the static configuration files.
A more practical example that actually uses translations and the database:
This event-based approach is used to make sure that your code that builds the menu runs only when the admin panel is actually displayed and not on every request.
Active menu items
By default, a menu item is considered active if any of the following holds:
- The current path matches the
url
parameter - The current path is a sub-path of the
url
parameter - If it has a submenu containing an active menu item
To override this behavior, you can specify an active
parameter with an array of active URLs, asterisks and regular expressions are supported.
To utilize regex, simply prefix your pattern with regex:
and it will get evaluated automatically. The pattern will attempt to match the path of the URL, returned by request()->path()
, which returns the current URL without the domain name. Example:
6.2 Plugins
By default the DataTables, Select2, ChartJS, Pace and SweetAlert2 plugins are supported and active, automatically injecting their CDN files.
You can also add and configure new plugins, modifying the plugin variable using the example structure below:
With the name string you specify the plugin name, and the active value will enable/disable the plugin injection.
Each plugin have a files array, with contain arrays with file type (js
or css
), and location
.
If the asset value is true
, the injection will use the asset() function.
6.2.1 Pace Plugin Configuration
You can change the Pace plugin appearence, when using the CDN injection modifying the css file location.
Color values: black, blue (default), green, orange, pink, purple, red, silver, white & yellow
Theme values: barber-shop, big-counter, bounce, center-atom, center-circle, center-radar (default), center-simple, corner-indicator, fill-left, flash, flat-top, loading-bar, mac-osx, minimal
7. Translations
At the moment, English, German, French, Dutch, Portuguese and Spanish translations are available out of the box.
Just specifiy the language in config/app.php
.
If you need to modify the texts or add other languages, you can publish the language files:
Now, you can edit translations or add languages in resources/lang/vendor/adminlte
.
7.1. Menu Translations
This resource allow you to use lang files, and is active by default.
Configurating Menu Using Lang:
First, configure the menu using the key text
as translation string.
This is an example of configuration:
Lang Files
All the translation strings must be added in the menu.php
file of each language needed.
The translations files are located at resources/lang/vendor/adminlte/
This is an example of the menu.php
lang file:
To translate the menu headers, just use the header
param. Example:
8. Customize views
If you need full control over the provided views, you can publish them:
Now, you can edit the views in resources/views/vendor/adminlte
.
9. Issues, Questions and Pull Requests
You can report issues and ask questions in the issues section. Please start your issue with ISSUE:
and your question with QUESTION:
If you have a question, check the closed issues first. Over time, I've been able to answer quite a few.
To submit a Pull Request, please fork this repository, create a new branch and commit your new/updated code in there. Then open a Pull Request from your new branch. Refer to this guide for more info.