-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Usage
To use the main blade template provided by this package, just create a new blade file and extend the provided AdminLTE layout with @extends('adminlte::page')
. This blade template yields the following main sections:
Section | Description |
---|---|
title |
Used to fill the content of the <title> tag, to define the title of the document that is shown in the browser page's tab |
content_header |
Used to fill the header element of the page (will be placed above the main content) |
content |
Used to fill all of the main content of the page |
footer |
Used to fill the content of the footer section |
right-sidebar |
Used to fill the content of the right sidebar (or control sidebar) |
css |
Used to add extra style sheets (inside the <head> tag) |
js |
Used to add extra scripts or javascript code (just before the closing </body> tag) |
In fact, all the mentioned sections are optional. As a basic example, your most common blade file extending the provided template could look like the following one:
@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')
{{-- Add here extra stylesheets --}}
{{-- <link rel="stylesheet" href="/css/admin_custom.css"> --}}
@stop
@section('js')
<script> console.log("Hi, I'm using the Laravel-AdminLTE package!"); </script>
@stop
Tip
On a fresh Laravel installation, and after installing this package, you can replace the resources/views/welcome.blade.php
file with the previous code for a fast template review.
Now, and as usual, you just return this view from a controller. It's a recommendation to check out AdminLTE v3 to find out how to build beautiful content for your admin panel. As a preview, the next image shows what you can get with the previous blade file definition:
Note
Screenshot was taken from package version v3.9.4
.
More over, this package also provides defaults template views for login and register pages, which can be used with @extends('adminlte::auth.login')
and @extends('adminlte::auth.register')
. Read the Authentication Views documentation for more details.
Important
The Tabbed IFrame mode is only available from version v3.7.0
of this package.
The IFrame mode provides the functionality to open the sidebar and top navbar links in a tabbed iframe
view. You can try this feature on the AdminLTE demo site to see what you can get. To use the IFrame
mode, you should define your main/welcome/root view as just:
@extends('adminlte::page', ['iFrameEnabled' => true])
The documentation of the configuration options available for this mode can be found on IFrame Mode Configuration. Please, note that all the other blade views of your application should be defined as explained before with the @extends('adminlte::page')
sentence and just the main entry view should be defined as explained before. Take next image as an example of what you will get:
Tip
The previous image was obtained from a fresh Laravel installation (after installing this package), by just replacing the resources/views/welcome.blade.php
file with @extends('adminlte::page', ['iFrameEnabled' => true])
.
Home | Installation | Updating | Usage | Basic Config | Layout Config | Menu Config | Plugins Config | Blade X-Components - Laravel-AdminTE