配置

安装完成之后,会生成两个配置文件,用来对管理后台进行配置,config/admin.phpapp/Admin/bootstrap.php

全局配置文件

全局配置文件 config/admin.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Laravel-admin name
    |--------------------------------------------------------------------------
    |
    | 登录页面的大标题,显示在登录页面
    |
    */
    'name' => 'Laravel-admin',

    /*
    |--------------------------------------------------------------------------
    | Laravel-admin logo
    |--------------------------------------------------------------------------
    | 
    | 管理页面的logo设置
    | 
    */
    'logo' => [

        'image' => '/vendor/laravel-admin/AdminLTE/img/AdminLTELogo.png',

        'text' => '<span class="font-weight-bolder">Laravel-admin</span>'
    ],

    /*
    |--------------------------------------------------------------------------
    | Laravel-admin bootstrap setting
    |--------------------------------------------------------------------------
    |
    | 用来设置启动文件
    |
    */
    'bootstrap' => app_path('Admin/bootstrap.php'),

    /*
    |--------------------------------------------------------------------------
    | Laravel-admin route settings
    |--------------------------------------------------------------------------
    |
    | 后台路由配置,应用在`app/Admin/routes.php`里面
    |
    */
    'route' => [

        'prefix' => 'admin',

        'namespace' => 'App\\Admin\\Controllers',

        'middleware' => ['web', 'admin'],
    ],

    /*
    |--------------------------------------------------------------------------
    | Laravel-admin install directory
    |--------------------------------------------------------------------------
    |
    | 后台的安装目录,如果在运行`admin:install`之前修改它,那么后台目录将会是这个配置的目录
    |
    */
    'directory' => app_path('Admin'),

    /*
    |--------------------------------------------------------------------------
    | Laravel-admin html title
    |--------------------------------------------------------------------------
    |
    | 所有页面的<title>标签内容
    |
    */
    'title' => 'Admin',

    /*
    |--------------------------------------------------------------------------
    | Access via `https`
    |--------------------------------------------------------------------------
    |
    | 后台是否使用https
    |
    */
    'https' => env('ADMIN_HTTPS', false),

    /*
    |--------------------------------------------------------------------------
    | Laravel-admin auth setting
    |--------------------------------------------------------------------------
    |
    | 后台用户使用的用户认证配置
    |
    */
    'auth' => [

        'controller' => App\Admin\Controllers\AuthController::class,

        'guards' => [
            'admin' => [
                'driver'   => 'session',
                'provider' => 'admin',
            ],
        ],

        'providers' => [
            'admin' => [
                'driver' => 'eloquent',
                'model'  => Encore\Admin\Models\Administrator::class,
            ],
        ],

        // Add "remember me" to login form
        'remember' => true,

        // 登陆之后的跳转地址
        'redirect_to' => 'auth/login',

        // 登陆验证的排除URI
        'excepts' => [
            'auth/login',
            'auth/logout',
            '_handle_form_',
            '_handle_action_',
            '_handle_selectable_',
            '_handle_renderable_',
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Laravel-admin upload setting
    |--------------------------------------------------------------------------
    |
    | 在Form表单中的image和file类型的默认上传磁盘和目录设置,其中disk的配置会使用在
    | config/filesystem.php里面配置的一项disk
    |
    */
    'upload' => [

        // `config/filesystem.php`中设置的disk
        'disk' => 'admin',

        // image和file类型表单元素的上传目录
        'directory' => [
            'image' => 'images',
            'file'  => 'files',
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Laravel-admin database settings
    |--------------------------------------------------------------------------
    |
    | 安装laravel-admin之后,默认会在数据库中新建下面2张表,包括用户、菜单表
    |
    | 其中的`connection`配置为下面几个模型所使用的数据库连接,对应`config/database.php`
    | 中的connections里面设置的connection,
    |
    | 如果你想修改数据库里面这几个表的名字,可以在运行`admin:install`之前修改它们
    | 如果install之后想修改,那么可以手动在数据库中修改,然后再修改下面几项的值
    |
    | 如果你需要在表里面增加字段,可以自定义模型,然后替换掉下面的模型设置即可,控制器的修改
    | 也可以通过覆盖路由的方式、覆盖掉内置的路由配置
    |
    */
    'database' => [

        // Database connection for following tables.
        'connection' => '',

        // User tables and model.
        'users_table' => 'admin_users',
        'users_model' => Encore\Admin\Auth\Database\Administrator::class,

        // Menu table and model.
        'menu_table' => 'admin_menu',
        'menu_model' => Encore\Admin\Auth\Database\Menu::class,
    ],

    /*
    |--------------------------------------------------------------------------
    | User default avatar
    |--------------------------------------------------------------------------
    |
    | 默认头像
    |
    */
    'default_avatar' => '/vendor/laravel-admin/AdminLTE/img/user2-160x160.jpg',

    /*
    |--------------------------------------------------------------------------
    | 主题设置
    |--------------------------------------------------------------------------
    |
    | @see  https://adminlte.io/docs/3.0/layout.html
    |
    */
    'theme' => [

        /*
        |--------------------------------------------------------------------------
        | Available layout options.
        |--------------------------------------------------------------------------
        | Fixed Sidebar: use the class `.layout-fixed` to get a fixed sidebar.
        | Fixed Navbar: use the class `.layout-navbar-fixed` to get a fixed navbar.
        | Fixed Footer: use the class `.layout-footer-fixed` to get a fixed footer.
        | Collapsed Sidebar: use the class `.sidebar-collapse` to have a collapsed sidebar upon loading.
        | Boxed Layout: use the class `.layout-boxed` to get a boxed layout that stretches only to 1250px.
        | Top Navigation: use the class `.layout-top-nav` to remove the sidebar and have your links at the top navbar.
        |
        */
        'layout' => ['sidebar-mini', 'sidebar-collapse', 'text-sm'],

        /*
        |--------------------------------------------------------------------------
        | Default color for all links.
        |--------------------------------------------------------------------------
        |
        | navbar-light or navbar-dark for content color
        |
        | navbar-$color for backgroud color
        |
        | Available $color options:
        |    primary secondary secondary info warning danger black gray-dark  gray
        |    light indigo  navy purple fuchsia pink maroon orange lime teal olive
        |
        */
        'navbar' => 'navbar-light navbar-white',

        /*
        |--------------------------------------------------------------------------
        | Default color for all links.
        |--------------------------------------------------------------------------
        |
        | Available options:
        |    primary secondary secondary info warning danger black gray-dark  gray
        |    light indigo  navy purple fuchsia pink maroon orange lime teal olive
        |
        */
        'accent' => 'info',

        /*
        |--------------------------------------------------------------------------
        | Default color for card form and buttons.
        |--------------------------------------------------------------------------
        |
        | light-$color or dark-$color
        |
        | Available $color options:
        |    primary secondary secondary info warning danger black gray-dark  gray
        |    light indigo  navy purple fuchsia pink maroon orange lime teal olive
        |
        */
        'sidebar' => 'light-info',

        /*
        |--------------------------------------------------------------------------
        | Default color for card, form and buttons.
        |--------------------------------------------------------------------------
        |
        | Available options:
        |    primary secondary secondary info warning danger
        */
        'color' => 'info',

        /*
        |--------------------------------------------------------------------------
        | Logo backgroud color.
        |--------------------------------------------------------------------------
        |
        | Available color options:
        |    primary secondary secondary info warning danger black gray-dark  gray
        |    light indigo  navy purple fuchsia pink maroon orange lime teal olive
        |
        */
        'logo' => 'light',
    ],

    /*
    |--------------------------------------------------------------------------
    | Login page background image
    |--------------------------------------------------------------------------
    |
    | 登录页面的背景图设置
    |
    */
    'login_background_image' => '',

    /*
    |--------------------------------------------------------------------------
    | Show version at footer
    |--------------------------------------------------------------------------
    |
    | 是否在页面的右下角显示当前laravel-admin的版本
    |
    */
    'show_version' => true,

    /*
    |--------------------------------------------------------------------------
    | Show environment at footer
    |--------------------------------------------------------------------------
    |
    | 是否在页面的右下角显示当前的环境
    |
    */
    'show_environment' => true,

    /*
    |--------------------------------------------------------------------------
    | Enable default breadcrumb
    |--------------------------------------------------------------------------
    |
    | 是否开启页面的面包屑导航
    */
    'enable_default_breadcrumb' => true,

    /*
    |--------------------------------------------------------------------------
    | 是否开启静态资源文件的压缩
    |--------------------------------------------------------------------------
    */
    'minify_assets' => [

        // 不需要被压缩的文件
        'excepts' => [

        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | 用来设置顶部的文字提示.
    |--------------------------------------------------------------------------
    */
    'top_alert' => '',

    /*
    |--------------------------------------------------------------------------
    | 设置数据表格的操作列显示类
    |--------------------------------------------------------------------------
    */
    'table_action_class' => \Encore\Admin\Table\Displayers\DropdownActions::class,

    /*
    |--------------------------------------------------------------------------
    | Extension Directory
    |--------------------------------------------------------------------------
    |
    | 如果你要运行`php artisan admin:extend`命令来开发扩展,需要配置这一项,来存放你的扩展文件
    */
    'extension_dir' => app_path('Admin/Extensions'),

    /*
    |--------------------------------------------------------------------------
    | Settings for extensions.
    |--------------------------------------------------------------------------
    |
    | 每一个laravel-admin扩展对应的配置,都写在这下面,扩展可以参考 https://github.com/laravel-admin-extensions
    |
    */
    'extensions' => [

    ],
];

启动文件

启动文件app/Admin/bootstrap.php

在这个配置文件中可以扩展或者移除你的组件,或者引入前端资源

<?php

/**
 * Laravel-admin - admin builder based on Laravel.
 * @author  z-song <https://github.com/z-song>
 *
 * Bootstraper for Admin.
 *
 * Here you can remove builtin form field:
 * Encore\Admin\Form::forget(['map', 'editor']);
 *
 * Or extend custom form field:
 * Encore\Admin\Form::extend('php', PHPEditor::class);
 *
 * Or require js and css assets:
 * Admin::css('/packages/prettydocs/css/styles.css');
 * Admin::js('/packages/prettydocs/js/main.js');
 *
 */