前言
Laravel Admin 是一个国产项目,作者是 song 。Laravel Admin 整合了 AdminLTE,内置了权限管理,还可以快速的创建数据表格和表单,更棒的是它是开源的,所以现在有很多人选择使用它来搭建管理后台。官网是https://laravel-admin.org/。
安装
首先确保安装好了laravel,并且数据库连接设置正确。
使用composer安装如下:
composer require encore/laravel-admin
然后运行下面的命令来发布资源:
php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider"
该命令会生成配置文件config/admin.php,可以在里面修改安装的地址、数据库连接、以及表名,建议都是用默认配置不修改。具体内容如下:
<?php
return [
/*
|--------------------------------------------------------------------------
| Laravel-admin name
|--------------------------------------------------------------------------
|
| This value is the name of laravel-admin, This setting is displayed on the
| login page.
|
*/
'name' => 'Laravel-admin',
/*
|--------------------------------------------------------------------------
| Laravel-admin logo
|--------------------------------------------------------------------------
|
| The logo of all admin pages. You can also set it as an image by using a
| `img` tag, eg '<img src="http://logo-url" alt="Admin logo">'.
|
*/
'logo' => '<b>Laravel</b> admin',
/*
|--------------------------------------------------------------------------
| Laravel-admin mini 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
| '<img src="http://logo-url" alt="Admin logo">'.
|
*/
'logo-mini' => '<b>La</b>',
/*
|--------------------------------------------------------------------------
| 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
|--------------------------------------------------------------------------
|
| The installation dir