1、安装
通过composer命令来引入
composer require encore/laravel-admin
然后根据官网文档说明,还需要通过下面2个命令来完成安装
php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider"
php artisan admin:install
2、生成的文件
安装完成后,我们来看看新增了哪些内容
3、访问
在浏览器中输入 http://admin.test/admin
, 注:admin.test
为我本地配置的域名
使用默认用户名:admin
密码: admin
来登录
4、配置信息 config/admin.php
'Laravel-admin',
/*
|--------------------------------------------------------------------------
| Laravel-admin logo 页面顶部logo
|--------------------------------------------------------------------------
|
| The logo of all admin pages. You can also set it as an image by using a
| `img` tag, eg ''.
|
*/
'logo' => 'Laravel admin',
/*
|--------------------------------------------------------------------------
| Laravel-admin mini logo 页面顶部小logo
|--------------------------------------------------------------------------
|
| The logo of all admin pages when the sidebar menu is collapsed. You can
| also set it as an image by using a `img` tag, eg
| ''.
|
*/
'logo-mini' => 'La',
/*
|--------------------------------------------------------------------------
| Laravel-admin route settings 路由配置
|--------------------------------------------------------------------------
|
| The routing configuration of the admin page, including the path prefix,
| the controller namespace, and the default middleware. If you want to
| access through the root path, just set the prefix to empty string.
|
*/
'route' => [
//路由前缀
'prefix' => 'admin',
//控制器命名空间前缀
'namespace' => 'App\\Admin\\Controllers',
//默认中间件列表
'middleware' => ['web', 'admin'],
],
/*
|--------------------------------------------------------------------------
| Laravel-admin install directory Laravel-admin 的安装目录
|--------------------------------------------------------------------------
|
| The installation directory of the controller and routing configuration
| files of the administration page. The default is `app/Admin`, which must
| be set before running `artisan admin::install` to take effect.
|
*/
'directory' => app_path('Admin'),
/*
|--------------------------------------------------------------------------
| Laravel-admin html title Laravel-admin 页面标题
|--------------------------------------------------------------------------
|
| Html title for all pages.
|
*/
'title' => 'Admin',
/*
|--------------------------------------------------------------------------
| Access via `https` 是否使用HTTPS
|--------------------------------------------------------------------------
|
| If your page is going to be accessed via https, set it to `true`.
|
*/
'https' => env('ADMIN_HTTPS', false),
/*
|--------------------------------------------------------------------------
| Laravel-admin auth setting Laravel-admin 用户认证设置
|--------------------------------------------------------------------------
|
| Authentication settings for all admin pages. Include an authentication
| guard and a user provider setting of authentication driver.
|
*/
'auth' => [
'guards' => [
'admin' => [
'driver' => 'session',
'provider' => 'admin',
],
],
'providers' => [
'admin' => [
'driver' => 'eloquent',
'model' => Encore\Admin\Auth\Database\Administrator::class,
],
],
],
/*
|--------------------------------------------------------------------------
| Laravel-admin upload setting Laravel-admin 文件上传设置
|--------------------------------------------------------------------------
|
| File system configuration for form upload files and images, including
| disk and upload path.
|
*/
'upload' => [
// Disk in `config/filesystem.php`.
'disk' => 'admin',
// Image and file upload path under the disk above.
'directory' => [
'image' => 'images',
'file' => 'files',
],
],
/*
|--------------------------------------------------------------------------
| Laravel-admin database settings Laravel-admin 数据库设置
|--------------------------------------------------------------------------
|
| Here are database settings for laravel-admin builtin model & tables.
|
*/
'database' => [
// Database connection for following tables. 数据库连接名称
'connection' => '',
// User tables and model. 管理员用户表及模型
'users_table' => 'admin_users',
'users_model' => Encore\Admin\Auth\Database\Administrator::class,
// Role table and model. 角色表及模型
'roles_table' => 'admin_roles',
'roles_model' => Encore\Admin\Auth\Database\Role::class,
// Permission table and model. 权限表及模型
'permissions_table' => 'admin_permissions',
'permissions_model' => Encore\Admin\Auth\Database\Permission::class,
// Menu table and model. 菜单表及模型
'menu_table' => 'admin_menu',
'menu_model' => Encore\Admin\Auth\Database\Menu::class,
// Pivot table for table above. 多对多中间表
'operation_log_table' => 'admin_operation_log',
'user_permissions_table' => 'admin_user_permissions',
'role_users_table' => 'admin_role_users',
'role_permissions_table' => 'admin_role_permissions',
'role_menu_table' => 'admin_role_menu',
],
/*
|--------------------------------------------------------------------------
| User operation log setting Laravel-admin 操作日志设置
|--------------------------------------------------------------------------
|
| By setting this option to open or close operation log in laravel-admin.
|
*/
'operation_log' => [
'enable' => true,
/*
* Only logging allowed methods in the list
*/
'allowed_methods' => ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'],
/*
* Routes that will not log to database.
* 不记操作日志的路由
* All method to path like: admin/auth/logs
* or specific method to path like: get:admin/auth/logs.
*/
'except' => [
'admin/auth/logs*',
],
],
/*
|--------------------------------------------------------------------------
| Admin map field provider
|--------------------------------------------------------------------------
|
| Supported: "tencent", "google", "yandex".
|
*/
'map_provider' => 'google',
/*
|--------------------------------------------------------------------------
| Application Skin 页面风格
|--------------------------------------------------------------------------
|
| This value is the skin of admin pages.
| @see https://adminlte.io/docs/2.4/skin
|
| Supported:
| "skin-blue", "skin-blue-light", "skin-yellow", "skin-yellow-light",
| "skin-green", "skin-green-light", "skin-purple", "skin-purple-light",
| "skin-red", "skin-red-light", "skin-black", "skin-black-light".
|
*/
'skin' => 'skin-blue-light',
/*
|--------------------------------------------------------------------------
| Application layout
|--------------------------------------------------------------------------
|
| This value is the layout of admin pages.
| @see https://adminlte.io/docs/2.4/layout
|
| Supported: "fixed", "layout-boxed", "layout-top-nav", "sidebar-collapse",
| "sidebar-mini".
|
*/
'layout' => ['sidebar-mini', 'sidebar-collapse'],
/*
|--------------------------------------------------------------------------
| Login page background image 登录背景图片
|--------------------------------------------------------------------------
|
| This value is used to set the background image of login page.
|
*/
'login_background_image' => '',
/*
|--------------------------------------------------------------------------
| Show version at footer 底部展示版本号
|--------------------------------------------------------------------------
|
| Whether to display the version number of laravel-admim at the footer of
| each page
|
*/
'show_version' => true,
/*
|--------------------------------------------------------------------------
| Show environment at footer
|--------------------------------------------------------------------------
|
| Whether to display the environment at the footer of each page
|
*/
'show_environment' => true,
/*
|--------------------------------------------------------------------------
| Extension Directory
|--------------------------------------------------------------------------
|
| When you use command `php artisan admin:extend` to generate extensions,
| the extension files will be generated in this directory.
*/
'extension_dir' => app_path('Admin/Extensions'),
/*
|--------------------------------------------------------------------------
| Settings for extensions. 扩展设置
|--------------------------------------------------------------------------
|
| You can find all available extensions here
| https://github.com/laravel-admin-extensions.
|
*/
'extensions' => [
],
];
Laravel-admin官方中文文档