Professional Documents
Culture Documents
Installation
1. Require the package using composer:
2. Updating
1. To update this package, first update the composer package:
3. Usage
To use the template, create a blade file and extend the layout
with @extends('adminlte::page'). This template yields the following sections:
All sections are in fact optional. Your blade template could look like the following.
@extends('adminlte::page')
@section('title', 'Dashboard')
@section('content_header')
<h1>Dashboard</h1>
@stop
@section('content')
<p>Welcome to this beautiful admin panel.</p>
@stop
@section('css')
<link rel="stylesheet" href="/css/admin_custom.css">
@stop
@section('js')
<script> console.log('Hi!'); </script>
@stop
Note that in Laravel 5.2 or higher you can also use @stack directive
for css and javascript:
{{-- resources/views/admin/dashboard.blade.php --}}
@push('css')
@push('js')
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.
resources/views/auth/login.blade.php:
@extends('adminlte::login')
resources/views/auth/register.blade.php
@extends('adminlte::register')
resources/views/auth/passwords/email.blade.php
@extends('adminlte::passwords.email')
resources/views/auth/passwords/reset.blade.php
@extends('adminlte::passwords.reset')
By default, the login form contains a link to the registration form. If you don't want a
registration form, set the register_urlsetting to null and the link will not be
displayed.
5. Configuration
First, publish the configuration file:
5.1 Menu
You can configure your menu as follows:
'menu' => [
'MAIN NAVIGATION',
[
'text' => 'Blog',
'url' => 'admin/blog',
],
[
'text' => 'Pages',
'url' => 'admin/pages',
'icon' => 'file'
],
[
'text' => 'Show my website',
'url' => '/',
'target' => '_blank'
],
'ACCOUNT SETTINGS',
[
'text' => 'Profile',
'route' => 'admin.profile',
'icon' => 'user'
],
[
'text' => 'Change Password',
'route' => 'admin.password',
'icon' => 'lock'
],
],
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:
[
[
'header' => 'BLOG',
'can' => 'manage-blog'
],
[
'text' => 'Add new post',
'url' => 'admin/blog/new',
'can' => 'add-blog-post'
],
]
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:
<?php
namespace MyApp;
use JeroenNoten\LaravelAdminLte\Menu\Builder;
use JeroenNoten\LaravelAdminLte\Menu\Filters\FilterInterface;
use Laratrust;
return $item;
}
}
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.
The configuration options are the same as in the static configuration files.
A more practical example that actually uses translations and the database:
$event->menu->add(...$items);
});
}
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.
To override this behavior, you can specify an active parameter with an array of active
URLs, asterisks and regular expressions are supported. Example:
[
'text' => 'Pages'
'url' => 'pages',
'active' => ['pages', 'content', 'content/*']
]
5.2 Plugins
By default the DataTables plugin is supported. If set to true, the necessary javascript
CDN script tags will automatically be injected into the adminlte::page.blade file.
'plugins' => [
'datatables' => true,
]
Also the Select2 plugin is supported. If set to true, the necessary javascript CDN
script tags will automatically be injected into the adminlte::page.blade file.
'plugins' => [
'datatables' => true,
'select2' => true,
]
Also the ChartJS plugin is supported. If set to true, the necessary javascript CDN
script tags will automatically be injected into the adminlte::page.blade file.
'plugins' => [
'datatables' => true,
'chartjs' => true,
]
6. 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:
php artisan vendor:publish --
provider="JeroenNoten\LaravelAdminLte\ServiceProvider" --tag=translations
Now, you can edit translations or add languages in resources/lang/vendor/adminlte.
7. Customize views
If you need full control over the provided views, you can publish them:
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.